Pre increment vs Post increment in array?

I am learning programming and I have started from C language. I was reading Let us C book. And I was going through t...

How to create a buffer for reading socket data in C?

Using C / C++ socket programming, and the "read(socket, buffer, BUFSIZE)" method. What exactly is the "buffer" I kn...

Error: incomplete type is not allowed?

in .h: typedef struct token_t TOKEN; in .c: #include "token.h" struct token_t { char* start; int length...

How can I create a dynamically sized array of structs??

I know how to create an array of structs but with a predefined size. However is there a way to create a dynamic arra...

forward declaration of a struct in C??

#include <stdio.h> struct context; struct funcptrs{ void (*func0)(context *ctx); void (*func1)(void); };...

Dereference void pointer?

Even after casting a void pointer, I am getting compilation error while dereferencing it. Could anyone please let me...

How to printf a memory address in C?

My code is: #include <stdio.h> #include <string.h> void main() { char string[10]; int A = ...

Difference between char* and const char*??

What's the difference between char* name which points to a constant string literal, and const char* name ...

C-equivalent of the 'setw' function?

In c++, setw function is used to set the number of characters to be used as the field width for the next insertion o...

What does {0} mean when initializing an object??

When {0} is used to initialize an object, what does it mean? I can't find any references to {0} anywhere, and becaus...

What's the difference between %ul and %lu C format specifiers??

In an example of "C Primer Plus", the author has used %ul format specifier (in both scanf and printf) for unsigned l...

What's the best way to check if a file exists in C??

Is there a better way than simply trying to open the file? int exists(const char *fname) { FILE *file; if (...

What is the difference between static const and const??

What is the difference between static const and const? For example: static const int a=5; const int i=5; Is there...