Top "C" questions

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

How to format strings using printf() to get equal length in the output?

I have two functions, one which produces messages like Starting initialization... and another which checks return codes and outputs "Ok", "…

c string printf pretty-print
__FILE__ macro shows full path

The standard predefined macro __FILE__ available in C shows the full path to the file. Is there any way to …

c file macros path
Returning string from C function

I haven't used C in over 3 years, I'm pretty rusty on a lot of things. I know this may seem …

c string return local-variables
How should I print types like off_t and size_t?

I'm trying to print types like off_t and size_t. What is the correct placeholder for printf() that is …

c portability format-specifiers
Simple way to check if a string contains another string in C?

I'm pretty new to the language. Let's say I have a string from an HTTP request, such as char * request = "…

c string substring
Dynamically create an array of strings with malloc

I am trying to create an array of strings in C using malloc. The number of strings that the array …

c arrays malloc
Divide a number by 3 without using *, /, +, -, % operators

How would you divide a number by 3 without using *, /, +, -, %, operators? The number may be signed or unsigned.

c math division divide
How to trigger SIGUSR1 and SIGUSR2?

I'm getting acquainted with signals in C. I can't figure out what kind of signals SIGUSR1 and SIGUSR2 are and …

c signals
Setting std=c99 flag in GCC

I was wondering if there were any files in which I could set the -std=c99 flag, so that I …

c programming-languages c99
Why would anybody use C over C++?

Although people seem to like to complain about C++, I haven't been able to find much evidence as to why …

c++ c