What does (void)var actually do?

It’s just a way of creating a ‘harmless’ reference to the variable. The compiler doesn’t complain about an unused variable, because you did reference the value, and it doesn’t complain that you didn’t do anything with the value of the expression var because you explicitly cast it to void (nothing), indicating that you didn’t care … Read more

What are the major differences between ANSI C and K&R C?

There may be some confusion here about what “K&R C” is. The term refers to the language as documented in the first edition of “The C Programming Language.” Roughly speaking: the input language of the Bell Labs C compiler circa 1978. Kernighan and Ritchie were involved in the ANSI standardization process. The “ANSI C” dialect … Read more

Where can one find the C89/C90 standards in PDF format?

You can find nice HTML versions of C89, C99, and C11, as well as some of the official draft PDF files they’re generated from, here: http://port70.net/~nsz/c/ Some other useful direct links to free PDF files of the C89/C90, C99 and C11 standards are listed below: C89/C90: https://www.pdf-archive.com/2014/10/02/ansi-iso-9899-1990-1/ansi-iso-9899-1990-1.pdf C99: http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1256.pdf C11: http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1570.pdf

Recursive declaration of function pointer in C

It’s not possible to do this in C: a function can’t return a pointer to itself, since the type declaration expands recursively and never ends. See this page for an explanation: http://www.gotw.ca/gotw/057.htm The workaround described on the above page means returning void (*) () instead of the correctly-typed function pointer; your workaround is arguably a … Read more