Questions tagged as 'c'

3
answers

Why in the C language array [6] equals 6 [array]?

Note: Question I saw in the SO in English , but I found it interesting to post here (because we do not have many C questions yet): Because in C language, does this code print "true"? #include <stdio.h> int main(void) { int reais...
asked by 29.01.2014 / 16:11
1
answer

When does Stack Overflow occur?

A question that has everything to do with the name of this site. We know that one of the most commonly used examples for demonstrating the execution stack of a program is recursion. A recursive function must have: stop condition and recursio...
asked by 01.11.2015 / 18:13
3
answers

Difference between% i and% d

Is there any difference between printf("%d", x); and printf("%i", x); ? I know the two return the same result, does it have some sort of convention adopted to always use %d ?     
asked by 12.09.2016 / 20:41
3
answers

Should I free up all allocated memory at the end of a program?

It is commonly accepted that when I allocate a block of memory I am responsible for releasing it. This is particularly true when programming based on RAII. However the following program works perfectly: int main() { int* ptr = new int[9999...
asked by 16.02.2014 / 15:49
3
answers

What does ": - -" mean in C language?

In a Linux kernel library, specifically this: / usr / include / linux / kernel.h , there is a macro with a strange code for me: /* Force a compilation error if condition is true, but also produce a result (of value 0 and type size_t), so th...
asked by 04.02.2014 / 12:04
2
answers

What is the purpose of the free () function?

In which cases should it be used? Is there an alternative? Is it recommended to use?
asked by 12.12.2014 / 12:18
4
answers

How to convert an int to two bytes in C / C ++?

I get the data from a temperature sensor on a microcontroller that has a 10-bit AD converter. I store the data in a variable of type int (of 32 bits), and I need to send this data via serial communication. For this, I need to convert this...
asked by 03.04.2014 / 19:03
2
answers

Meaning of "__"

In the Linux kernel implementation , I came across this statement on the line 89: #define _THIS_IP_ ({ __label__ __here; __here: (unsigned long)&&__here; }) I know that in C , symbols starting with a _ followed by a ca...
asked by 28.09.2016 / 21:26
2
answers

Is it possible to program object-oriented in C?

Is it possible to build a C program using OOP? I looked at several sites for examples of this, but I did not find anything concrete, that really tells me whether or not it works. If so, please put at least one code sample.     
asked by 11.08.2015 / 21:45
2
answers

What is the meaning of the "&" (and commercial) operator in the C language?

I'm putting together a C booklet and I'm looking for a clear way to explain this operator to the reader, and I believe that this doubt will greatly help the people who are just getting started. See an example: Code #include <stdio.h&g...
asked by 28.04.2016 / 18:53