Top "C" questions

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

How do I make a simple makefile for gcc on Linux?

I have three files: program.c, program.h and headers.h. program.c includes program.h and headers.h. I …

c gcc makefile
How to split a string literal across multiple lines in C / Objective-C?

I have a pretty long sqlite query: const char *sql_query = "SELECT statuses.word_id FROM lang1_words, statuses WHERE …

c objective-c
Simple C example of doing an HTTP POST and consuming the response

I would like to create a very simple C application that does an HTTP post. It will take a few …

c http http-post
How to code a modulo (%) operator in C/C++/Obj-C that handles negative numbers

One of my pet hates of C-derived languages (as a mathematician) is that (-1) % 8 // comes out as -1, and not 7 …

c++ c c++11 operator-overloading modulo
hash function for string

I'm working on hash table in C language and I'm testing hash function for string. The first function I've tried …

c algorithm hash dictionary hashtable
How can I find the number of elements in an array?

I have an int array and I need to find the number of elements in it. I know it has …

c arrays sizeof
How to print an unsigned char in C?

I am trying to print char as positive value: char ch = 212; printf("%u", ch); but I get: 4294967252 How I can …

c printf
How can I compare strings in C using a `switch` statement?

In C there is a switch construct which enables one to execute different conditional branches of code based on an …

c string switch-statement string-comparison
C dynamically growing array

I have a program that reads a "raw" list of in-game entities, and I intend to make an array holding …

c dynamic-arrays
Determine if char is a num or letter

How do I determine if a char in C such as a or 9 is a number or a letter? Is …

c char alphanumeric