Top "C" questions

C is a general-purpose programming language used for system programming (OS and embedded), libraries, games and cross-platform.

Why is the use of alloca() not considered good practice?

alloca() allocates memory on the stack rather than on the heap, as in the case of malloc(). So, when I …

c stack malloc allocation alloca
How can I check if char* variable points to empty string?

How can I check if char* variable points to an empty string?

c pointers char
What is your favorite C programming trick?

For example, I recently came across this in the linux kernel: /* Force a compilation error if condition is true */ #define …

c
Rerouting stdin and stdout from C

I want to reopen the stdin and stdout (and perhaps stderr while I'm at it) filehandles, so that future calls …

c redirect stdio
Split string into tokens and save them in an array

How to split a string into an tokens and then save them in an array? Specifically, I have a string "…

c split strtok
Avoid trailing zeroes in printf()

I keep stumbling on the format specifiers for the printf() family of functions. What I want is to be able …

c printf
How to printf long long

I'm doing a program that aproximate PI and i'm trying to use long long, but it isn't working. Here is …

c long-integer pi
How do I align a number like this in C?

I need to align a series of numbers in C with printf() like this example: -------1 -------5 ------50 -----100 ----1000 …

c printf alignment
Differences between fork and exec

What are the differences between fork and exec?

c unix fork exec
What happens to a declared, uninitialized variable in C? Does it have a value?

If in C I write: int num; Before I assign anything to num, is the value of num indeterminate?

c initialization declaration