Top "C" questions

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

Why do pthreads’ condition variable functions require a mutex?

I’m reading up on pthread.h; the condition variable related functions (like pthread_cond_wait(3)) require a mutex as …

c pthreads mutex condition-variable
Super high performance C/C++ hash map (table, dictionary)

I need to map primitive keys (int, maybe long) to struct values in a high-performance hash map data structure. My …

c++ c dictionary hashtable hashmap
malloc(sizeof(int)) vs malloc(sizeof(int *)) vs (int *)malloc(sizeof(int))

I acknowledge that all three of these have a different meaning. But, I don't understand on what particular instances would …

c memory allocation malloc
Read a file as byte array

I have an assignment for coding a Huffman algorithm. I have the whole problem organized in my head, but I'm …

c file-io huffman-code
Bad file descriptor

I'm learning about file descriptors and I wrote this code: #include <unistd.h> #include <stdio.h> #…

c file unix file-descriptor
Convert a preprocessor token to a string

I'm looking for a way to convert a preprocessor token to a string. Specifically, I've somewhere got: #define MAX_LEN 16 …

c c-preprocessor stringification
Is it possible to call a C function from C#.Net

I have a C lib and want to call function in this library from C# application. I tried creating a …

c c#-4.0 interop
Time complexity of N Queen using backtracking?

#include<stdio.h> #include<math.h> void printboard(int n); void fourQueen(int k,int n); …

c algorithm n-queens
Getopt- Passing string parameter for argument

I have a program which takes in multiple command line arguments so I am using getopt. One of my arguments …

c getopt
How to Compile for OS X in Linux or Windows?

I would like to port my C/C++ apps to OS X. I don't have a Mac, but I have …

c++ c macos cross-compiling