Top "C" questions

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

printf and long double

I am using the latest gcc with Netbeans on Windows. Why doesn't long double work? Is the printf specifier %lf …

c gcc printf long-double
How do I use typedef and typedef enum in C?

Consider: #define MAXROW 20 #define MAXCOL 60 typedef State Grid[MAXROW+2] [MAXCOL+2] typedef enum state {DEAD,ALIVE} State How do I use …

c typedef
Printf width specifier to maintain precision of floating-point value

Is there a printf width specifier which can be applied to a floating point specifier that would automatically format the …

c floating-point printf c99 floating-point-precision
How to increment a pointer address and pointer's value?

Let us assume, int *p; int a = 100; p = &a; What will the following code will do actually and how? …

c pointers
Mutex example / tutorial?

I'm new to multithreading, and was trying to understand how mutexes work. Did a lot of Googling but it still …

c++ c multithreading synchronization mutex
Do I cast the result of malloc?

In this question, someone suggested in a comment that I should not cast the result of malloc, i.e. int *…

c malloc casting
Printing 1 to 1000 without loop or conditionals

Task: Print numbers from 1 to 1000 without using any loop or conditional statements. Don't just write the printf() or cout statement 1000 …

c++ c printf
close vs shutdown socket?

In C, I understood that if we close a socket, it means the socket will be destroyed and can be …

c sockets networking
How to track down a "double free or corruption" error

When I run my (C++) program it crashes with this error. * glibc detected * ./load: double free or corruption (!prev): 0x0000000000…

c++ c debugging free