Questions tagged as 'char'

1
answer

Does a char type always have size 1?

I've always known that char is the only type that has fixed size by specification. Its size is 1, no matter the architecture. But I came across sizeof('a') returning 4 rather than 1. Like this? Did I Learn Wrong?     
asked by 19.01.2017 / 11:18
2
answers

Graph in Bars Char.js

Well folks I have a query of the Bank that returns an array of data. and wanted to put the values to be displayed in the graph in Bars. I tried this but with values coming from vector the graph does not load. while ($estoque = $estoques->...
asked by 22.01.2016 / 13:56
2
answers

One character length (ASCII vs. other encodings) in bytes

Viewing this question came up with a question, coming from PHP and in the past having "problems" derived from character encoding, eg: srtpos " vs mb_strpos , I knew that all characters ASCII have 1 byte, but I thought that speci...
asked by 19.01.2017 / 12:11
1
answer

error: initializer element is not constant

I'm trying to declare this buffer on global and when compiling displays the following error    error: initializer element is not constant char *ls_buffer_PPouAUT = malloc(5120*sizeof(char)); How can I resolve it?     
asked by 22.07.2016 / 15:35
3
answers

Comparison of char in C

I need to find out if each element in a linked list is a vowel or not. How can I fix my code? int BuscaNv(LISTA* resp){ NO* atual = resp->inicio; while(atual){ if(atual->letra == 'a' || 'e' || 'i' || 'o' || 'u'){ pri...
asked by 04.09.2017 / 14:01
4
answers

How to convert a char to an integer?

Converting a string to an integer with the atoi() function is easy, is not it? However, when I use the atoi() function to convert a character to an integer, the program that is at runtime simply crashes. What would be...
asked by 01.04.2018 / 23:53
2
answers

Storing Strings in Vectors - C

How do I store more than one name in a variable of type char , why put it, let's assume name [20] , I'm defining that it has received 20 characters, not that it can receive 20 elements, the code I'm trying to test, that's it here. #include...
asked by 31.10.2018 / 16:42
2
answers

How do I get the first character of a String and make it uppercase by storing it in a variable?

String user,newUser,newPassword, password, resposta, user1,pass1; user = "admin"; password = "123"; Console.WriteLine("LOGIN\n"); body: Console.WriteLine("Ja possui login?"); resposta = Console...
asked by 06.09.2018 / 21:36
2
answers

Problem loading file in memory

I'm trying to load several files into memory (small files), but the problem is that when I try to load another file soon then all files have the same name as the last file loaded. I'm using a struct that contains name, size of the name...
asked by 17.07.2014 / 00:39
1
answer

char data type needs space after quotation marks in scanf

#include <stdio.h> #include <stdlib.h> void main(){ char elevador; int cod=0, a=0, b=0, c=0; while(cod == 0){ printf("\nElevador utilizado (a/b/c)? "); scanf("%c", &elevador); switch(elevador){ case 'a...
asked by 19.06.2017 / 05:59