Top "C" questions

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

Why can a string be assigned to a char* pointer, but not to a char[] array?

Can someone explain why this works with the pointer: char * str1; str1 = "Hello1"; str1 = "new string"; // but not this char …

c string pointers initialization reusability
clock_gettime alternative in Mac OS X

When compiling a program I wrote on Mac OS X after installing the necessary libraries through MacPorts, I get this …

c macos time clock
Kill Thread in Pthread Library

I use pthread_create(&thread1, &attrs, //... , //...); and need if some condition occured need to kill this thread how …

c multithreading pthreads posix
Function pointer as an argument

Is it possible to pass a function pointer as an argument to a function in C? If so, how would …

c function-pointers argument-passing
How to split a C program into multiple files?

I want to write my C functions in 2 separate .c files and use my IDE (Code::Blocks) to compile everything …

c codeblocks
How define an array of function pointers in C

I've a little question. I'm trying to define an array of function pointers dynamically with calloc. But I don't know …

c++ c arrays function-pointers
C Programming: malloc() inside another function

I need help with malloc() inside another function. I'm passing a pointer and size to the function from my main() …

c function pointers malloc
Why does the indexing start with zero in 'C'?

Why does the indexing in an array start with zero in C and not with 1?

c arrays
unsigned long long type printing in hexadecimal format

I am trying to print out an unsigned long long like this: printf("Hex add is: 0x%ux ", hexAdd); but …

c integer printf
Regular expression for a string literal in flex/lex

I'm experimenting to learn flex and would like to match string literals. My code currently looks like: "\""([^\n\"\\]*(\\[.\n])*)*"\"" {/*matches …

c regex lex string-literals flex-lexer