C / ANSI-C examples (example source code) Organized by topic

stdio.h /

clearerr 1fclose 1
feof 1ferror 1
fflush 1fgetc 1
fgetpos 1fgets 1
fopen 2fprintf 1
fputc 1fputs 1
fread 1freopen 1
fscanf 1fseek 1
fsetpos 1ftell 1
fwrite 1getc 1
getchar 1gets 1
perror 1printf 39
putc 1putchar 1
puts 1remove 1
rename 1rewind 1
scanf 2setbuf 1
setvbuf 1snprintf 1
sprintf 1sscanf 1
tmpfile 1tmpnam 1
ungetc 1

stdlib.h /

abort 1abs 1
atexit 1atof 1
atoi 1atol 1
atoll 1bsearch 1
calloc 1div 1
Exit 2 1exit 1
free 1getenv 1
labs 1ldiv 1
llabs 1lldiv 1
malloc 1mblen 1
mbstowcs 1mbtowc 1
qsort 1rand 1
realloc 1srand 1
strtod 1strtof 1
strtold 1strtoll 1
strtoul 1strtoull 1
system 1wcstombs 1

string.h /

memchr 1memcmp 1
memcpy 1memmove 1
memset 1strcat 1
strchr 1strcmp 1
strcoll 1strcpy 1
strcspn 1strerror 2
strlen 1strncat 1
strncmp 1strncpy 1
strpbrk 1strrchr 1
strspn 1strstr 1
strxfrm 1

math.h /

acos 1acosh 1
asin 1asinh 1
atan 1atan2 1
atanh 1cbrt 1
ceil 1copysign 1
cos 1cosh 1
erf 1erfc 1
exp 1exp2 1
expm1 1fabs 1
fdim 1floor 1
fma 1fmax 1
fmin 1fmod 1
fpclassify 1frexp 1
hypot 1ilogb 1
isfinite 1isgreater 1
isgreaterequal 1isinf 1
isless 1islessequal 1
islessgreater 1isnan 1
isnormal 1isunordered 1
ldexp 1lgamma 1
llrint 1llround 1
log 1log10 1
log1p 1log2 1
logb 1lrint 1
lround 1modf 1
nan 1nearbyint 1
nextafter 1nexttoward 1
pow 1remainder 1
remquo 1rint 1
round 1scalbln 1
scalbn 1signbit 1
sin 1sinh 1
sqrt 1strftime 1
tan 1tanh 1
tgamma 1time 1
trunc 1

ctype.h /

isalnum 1isalpha 1
isblank 1iscntrl 1
isdigit 1isgraph 1
islower 1isprint 1
ispunct 1isspace 1
isupper 1isxdigit 1
tolower 1toupper 1

time.h /

asctime 1clock 1
ctime 1difftime 1
gmtime 1localeconv 1
localtime 1mktime 1
setlocale 1tm 1

assert.h /

assert 1

wctype.h /

iswalnum 1iswalpha 1
iswblank 1iswcntrl 1
iswdigit 1iswgraph 1
iswlower 1iswprint 1
iswpunct 1iswspace 1
iswupper 1iswxdigit 1
towlower 1

signal.h /

raise 1

setjmp.h /

longjmp 1setjmp 1

Data Type /

Array Char 15Array Double 3
Array Float 1Array Int 16
Array String 1Array Two Dimension 14
Binary Display 1Bit AND 1
Bit OR 1Bit Reverse 1
Bit Shift 4Bitwise XOR 3
Char Validation 14Char 12
Constant 4Control Character 7
Decimal 1Define New Type 1
Double 7Enum 5
Float 14Hex 4
Int Convert 4Int 19
Long 6Register 2
Short 1Static 5
Union 2

Pointer /

Pointer Array 6Pointer Char 10
Pointer Double 2Pointer Int 14
Pointer Long 1Pointer Pointer 2
Pointer String 2

String /

String Append 9String Case 2
String Compare 6String Convert 16
String Copy 6String General 17
String Length 11String Search 15
String Split 4

Data Structure Algorithm /

Bubble Sort 3Insertion Sort 1
Link List 1Queue 2
Quick sort 8Search 2
Selection Sort 1Shaker Sort 1
Shell Sort 1Stack 2
Tree 4

Console /

Console Input Validation 1Console Menu 1
Console Output Char 4Console Output float 1
Console Output Int 5Console Output String 8
Console Output 2Console Read Any 2
Console Read Char 7Console Read Decimal 1
Console Read Int 6Console Read String 6
Console Read Validation 8Formatted Output Float 5
Formatted Output Hex 1Formatted Output Int 6
Formatted Output String 1Printf 6
Scanf 5

Language Basics /

Comments 2Do While 7
Extern 1For Break 5
For Continue 2For 31
Goto 1If 20
Main 7Operator General 14
Operator Rank 1Operator Relation 3
Operator Self Increase 3Operator Ternary 7
Statement 1Switch 11
Variable Scope 14Variable 4
While 4

Development /

Assert 1Bar Chart 1
Beep 2Command Line Parameters 10
Compile Info 1Debug 3
Environment 1error 6
Exit Abort 4Locale 2
Print 1System Command 2
Table 1Time Date 21
Timer 2

Structure /

Struct Define 8Struct Size 2
Structure Array 4Structure Parameters 1
Structure Serialization 2

Memory /

Memory Allocation 10Memory Compare 2
Memory Copy 2Memory Free 1
Memory Jump 1Memory Move 2
Memory Save 1Memory Search 1
Memory Set 2

Math /

Absolute Value 4Cos ACos 6
Divide 5Exp 4
Log 4Mod 5
Power 3Random 10
Round 2Sin ASin 8
Square Root 2Tan ATan 8

File /

Binary File 1File Close 1
File Compare 1File Content Search 5
File Copy 3File Delete 4
File End 4File Error 1
File fprintf fscanf 2File fwrite fread 1
File Open 6File Pointer 4
File Read 16File Rename 2
File Temp 3File Write 20
Stream Buffer 1

Macro Preprocessor /

if def 4ifndef 1
Inline 1Line 1
Macro Basic 3Macro Constant 10
Macro Function 10Macro String 3
Preprocessor IF 3Preprocessor LINE 1
Preprocessor 1

Function /

Function Parameters 21Function Pointer 10
Function Recursive 7Function 31

Small Application /

Calculator 2