Questions tagged as 'c'

1
answer

What is head of the threaded list?

I do not understand what head or head ) of the list means, and what is the advantage in using it?     
asked by 08.12.2016 / 13:43
1
answer

What are C-digraphs?

Based on the trigraphs question, what are digraphs? Why were they created? What are the sequences? Do the current compilers still allow you to use them?
asked by 18.12.2015 / 21:43
1
answer

Why can I access a structure other than the pointer?

When I declare a pointer to struct I can access members without putting the address of a struct , why is it possible? For example: struct exemplo{ int a ; }; int main() { struct exemplo *p; p->a = 10 ; }    ...
asked by 22.12.2015 / 22:24
1
answer

How to allocate a member of a struct in C?

I would like to know if it is possible to allocate a atributo of a struct , follow my struct example: struct MinhaStructExemplo { int * atributo_quantidade; /*Atributo que eu gostaria de alocar na memoria*/ }; For the...
asked by 27.11.2015 / 00:35
1
answer

What are the practical differences in C and C ++ code portability?

I've been reading some open-source C code lately and I've noticed that a lot of them have become quite complex with a lot of #ifdef to make the code as portable as possible between various platforms and * NIX. Some even support different...
asked by 09.10.2014 / 01:40
1
answer

Data Alignment, Data Structure Padding and C

Can anyone explain how the render / compile does the padding? I do not understand why the structc_t structure has a size of 24, should not it be equal to the structd_t structure? Note: Data on Intel 64-bit, 64-bit Windows #include <stdio.h&...
asked by 20.08.2014 / 04:12
1
answer

Analyze whether a number is even or odd

The program should do: Digite um Número: 12345 1 e ímpar 2 e par 3 e ímpar 4 e pra 5 e ímpar So far I've made the following code: void parImpar (int num) { int resto; while (num > 0) { resto = num%10;...
asked by 31.08.2018 / 05:03
1
answer

What is the need to use the suffix "f" in a numeric constant in C?

Is it necessary to add f to a float value within the parameters of a if ? Example: if (a == 2.5f && a > 2.0f) {}     
asked by 28.08.2018 / 17:41
1
answer

My factorial function does not return the expected value! C language

My teacher is starting to go through functions, and asked us to do a factorial function of a number, but it always returns the wrong value and I do not know what happens. Code: int fatorial(int n) { int ans = 1; while(n>1){ ans*=n;...
asked by 26.08.2018 / 18:39
1
answer

What are Macros and how to use them?

So far during my C programming course, the only contact I had with macros came from standard libraries and I did not know very well what happened when I called these macros. I would like to know what exactly macros are, how to create one in C /...
asked by 09.06.2015 / 00:06