Top "C" questions

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

Object-orientation in C

What would be a set of nifty preprocessor hacks (ANSI C89/ISO C90 compatible) which enable some kind of ugly (…

c oop object
Does `break` work only for `for`, `while`, `do-while`, `switch' and for `if` statements?

Suppose, I have a if statement inside a for loop: for( ; ; ) { if( ) { printf(" inside if"); break; }//if printf("inside for"); }//…

c break
Inline functions vs Preprocessor macros

How does an inline function differ from a preprocessor macro?

c++ c macros inline
Understanding container_of macro in the Linux kernel

When I was browsing the Linux kernel, I found a container_of macro which is defined as follows: #define container_…

c linux-kernel c-preprocessor
fast algorithm for drawing filled circles?

I am using Bresenham's circle algorithm for fast circle drawing. However, I also want to (at the request of the …

c algorithm graphics geometry
Reading from file using fgets

I am reading from file of format 1 32 43 23 32 43 123 43 54 243 123 2222 2 Here is my code snippet. string[100]; while(!feof(fp)) fgets(string,100,fp) Now, …

c fgets file-read
Programmatically get the cache line size?

All platforms welcome, please specify the platform for your answer. A similar question: How to programmatically get the CPU cache …

c++ c caching operating-system systems-programming
Obfuscated C Code Contest 2006. Please explain sykes2.c

How does this C program work? main(_){_^448&&main(-~_);putchar(--_%64?32|-~7[__TIME__-_/8%8][">'txiZ^(~z?"-48]&…

c obfuscation deobfuscation
How do you convert void pointer to char pointer in C

Ok this has been become sooo confusing to me. I just don't know what is wrong with this assignment: void *…

c pointers void-pointers
Determine size of dynamically allocated memory in C

Is there a way in C to find out the size of dynamically allocated memory? For example, after char* p = …

c memory dynamic size allocation