Top "C" questions

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

Is there a way to insert assembly code into C?

I remember back in the day with the old borland DOS compiler you could do something like this: asm { mov …

c inline-assembly assembly
Are stack variables aligned by the GCC __attribute__((aligned(x)))?

i have the following code: #include <stdio.h> int main(void) { float a[4] __attribute__((aligned(0x1000))) = {1.0, 2.0, 3.0, 4.0}; printf("%p %…

c gcc memory-alignment callstack
How do I get a thread ID from an arbitrary pthread_t?

I have a pthread_t, and I'd like to change its CPU affinity. The problem is that I'm using glibc 2.3.2, …

c linux unix pthreads system-calls
How does fread really work?

The declaration of fread is as following: size_t fread(void *ptr, size_t size, size_t nmemb, FILE *stream); …

c fread
c send and receive file

This is the server (sendfile) part: offset = 0; for (size_to_send = fsize; size_to_send > 0; ){ rc = sendfile(newsockd, fd, &…

c sockets sendfile
What are the benefits of a relative path such as "../include/header.h" for a header?

I've reviewed questions How to use include directive correctly and C++ #include semantics and neither addresses this - nor do …

c include header
Lua - Number to string behaviour

I would like to know how Lua handles the number to string conversions using the tostring() function. It is going …

c lua tostring
Increasing camera capture resolution in OpenCV

In my C/C++ program, I'm using OpenCV to capture images from my webcam. The camera (Logitech QuickCam IM) can …

c image opencv webcam resolutions
How to share memory between processes created by fork()?

In fork child, if we modify a global variable, it will not get changed in the main program. Is there …

c fork
How to cut part of a string in c?

I'm trying to figure out how to cut part of a string in C. For example you have this character …

c string cut