Top "C" questions

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

Compare between a char in a string to a given char

I have the following: int findPar(char* str) { int counter=0; while (*str) { if(str[0] == "(") <---- Warning { counter++; } else if (…

c++ c string strcmp
Find which assembly instruction caused an Illegal Instruction error without debugging

While running a program I've written in assembly, I get Illegal instruction error. Is there a way to know which …

c linux assembly x86-64 yasm
How do I measure time in C?

I want to find out for how long (approximately) some block of code executes. Something like this: startStopwatch(); // do some …

c windows winapi time
gcc will not properly include math.h

Here is a minimal example outlining my problem test.c: #include <stdio.h> #include <math.h> …

c gcc linker static-libraries
Warning: array subscript has type char

When I am running this program I am getting warning "array subscript has type 'char'". Please help me where is …

c codeblocks
Is there an equivalent to WinAPI's MAX_PATH under linux/unix?

If I want to allocate a char array (in C) that is guaranteed to be large enough to hold any …

c++ c linux unix posix
What's the point of malloc(0)?

I just saw this code: artist = (char *) malloc(0); ...and I was wondering why would one do this?

c malloc
Are typedef and #define the same in c?

I wonder if typedef and #define are the same in c?

c macros c-preprocessor typedef
Measure time in Linux - time vs clock vs getrusage vs clock_gettime vs gettimeofday vs timespec_get?

Among the timing functions, time, clock getrusage, clock_gettime, gettimeofday and timespec_get, I want to understand clearly how they …

c linux time linux-kernel
What happens when I assign long int to int in C?

In a recent homework assignment I've been told to use long variable to store a result, since it may be …

c casting integer variable-assignment long-integer