Top "C" questions

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

How is malloc() implemented internally?

Can anyone explain how malloc() works internally? I have sometimes done strace program and I see a lot of sbrk …

c memory malloc system-calls sbrk
C: how to break apart a multi digit number into separate variables?

Say I have a multi-digit integer in C. I want to break it up into single-digit integers. 123 would turn into 1, 2, …

c math numbers digits digit
Why do I get a C malloc assertion failure?

I am implementing a divide and conquer polynomial algorithm so I can benchmark it against an OpenCL implementation, but I …

c gcc malloc assertion
C free(): invalid pointer

I am teaching myself C. My goal is to make a C function that just walks a query string and …

c pointers free valgrind
How to use nan and inf in C?

I have a numerical method that could return nan or inf if there was an error, and for testing purposed …

c math
What's sizeof(size_t) on 32-bit vs the various 64-bit data models?

On a 64-bit system, sizeof(unsigned long) depends on the data model implemented by the system, for example, it is 4 …

c 64-bit sizeof size-t
htons() function in socket programing

I am new to socket programming and I am trying to understand the operation of htons(). I've read a few …

c sockets unix-socket
state machines tutorials

I am just wondering if anyone know of some good tutorials on the Internet for developing state machines. Or ebooks? …

c c99 state-machine
getch and arrow codes

I'm writing a programm that's using getch() to scan for arrow keys. My code so far is: switch(getch()) { case 65: // …

c character decimal arrow-keys getch