Questions tagged as 'c'

1
answer

To learn C ++ is it necessary to learn C?

If I want to learn about C ++, do I need to learn C before or are they different things?     
asked by 10.12.2018 / 12:40
4
answers

What happens when I convert int to char?

An integer has 4 bytes , whereas a char has only 1 byte . When I make this definition: int a = 1000; // 1111101000 char b = (char) a; I think it will only take 1 byte of data, but what I want to know is whether it will pick up a...
asked by 21.03.2014 / 21:30
1
answer

Because the practice of "constant parameter" only exists in C

In C, there is the practice of applying the modifier "const" to function parameters when the function is not intended to change the parameter. As in this code: char process_string(const char *str); Because in other languages there is no suc...
asked by 13.03.2014 / 08:04
2
answers

How does C99 work on the C90 for declaration of variables in the middle of the code?

In C90 and C89 we have that the loop for must have its variable declared earlier at the beginning of the function scope, eg: void main (void) { int i; for(i = 0; i < 10; i++) { /* Qualquer coisa */ } }...
asked by 26.01.2015 / 12:11
3
answers

format '% d' expects argument of type 'int', but argument 2 has type 'char *' - What is this? How to pack?

Code: #include <stdio.h> int main(void) { char caractere, *caractere_ptr = &caractere; printf("Caractere: foi alocado %zu byte\n", sizeof(caractere)); printf("Endereço: %d", caractere_ptr); return 0...
asked by 23.01.2017 / 19:09
3
answers

How does the rotation of bits in C work?

I would like to know how the bit rotation works, because the content that I could find on the internet does not explain for sure. Note: The structure is as follows: unsigned _rotl(unsigned valor,int conta); // deslocamento para a esquerda u...
asked by 17.03.2014 / 00:08
2
answers

Is it possible to further simplify this asterisked pyramid code?

I'm having a simple exercise where I need to make a pyramid using a repeat structure. The pyramid has 17 columns and 9 rows. My program displays it correctly, Is it possible to reduce some line or some for ? #include <stdio.h>...
asked by 24.06.2016 / 01:22
3
answers

How to create and read ".conf" files in C, for linux environment?

I'm studying C in linux environment. I have a problem with how to create a configuration file for my program to know what to do when running. Question Does anyone know how to store and read variables in .conf files? Is there a...
asked by 05.10.2016 / 09:53
3
answers

How do I delete a character within a string?

In this code I read two strings and remove all first letters in common with the second string . But how do you put a null character in place of this letter in common in the two strings ? My code looks like this: char str1[15], str2[15];...
asked by 12.09.2014 / 20:34
3
answers

When to use size_t?

Now research the subject, but I always get confused. I found a article in English that explains very well some reasons for the existence of the type and how to use it. In this article the type is meant to represent sizes in bytes of objects, h...
asked by 20.04.2015 / 22:54