C and C++ Source Code Snippets

Welcome to Cprogramming.com's programming code snippet repository. Peruse the archives or add your own snippets for others to use! (Check the following link a better definition of a snippet)

Sort by clicking on any of the headers.

SnippetAuthorLanguagePlatformRating (votes)
a short BubbleSort algoritm for Integer ArraysMajor_Small C or C++ANSI6.1 (203)
An example of using the same variable name in different scopesAli Nawkhas Murad C++ANSI6.1 (77)
Template Calculatorprog-bman C++ANSI6.1 (276)
Print variables with file and line number for debuggingmike lear C++ANSI6.1 (12)
Initial values for static multidimensional arrayAli Nawkhas Murad C or C++ANSI6.1 (76)
how to implement strlwr in CSyed Rafey Husain C or C++ANSI5.9 (14)
Validate Longitudinal Redundancy Checksum (LRC)Darko Kolaković C or C++ANSI5.9 (138)
ASCII table generatorAbdul Haseeb Mir C++ANSI5.9 (79)
euler approximation methoderic mbakop C or C++ANSI5.9 (256)
Simple example for using thousand separator (,)Ali Nawkhas Murad C++ANSI5.9 (63)
GetLastError error lookup toolKen Fitlike CWindows5.8 (185)
Calculates 1 variable statisticsPaul Kennedy C++ANSI5.8 (9)
similar to gotoxy; minimal screen control for wyseMike Kinney C or C++ANSI5.8 (156)
A very simple frames per second functionJeff Verkoeyen C or C++Windows5.8 (197)
This C code recursively sorts an array of upto 20Abhishek H.Dwivedi C or C++ANSI5.8 (209)
An example of Exception HandlingAli Nawkhas Murad C++ANSI5.7 (66)
Calculates the closest point to a segmentAdrián Deccico C or C++ANSI5.7 (133)
Converts a real number to the string.Darko Kolakoviћ C or C++ANSI5.6 (238)
Integer Partitions from 1 to NChristopher Brown 5.6 (9)
Create a new file under linuxChol Nhial 5.6 (9)
Tic-TacToeptrs 5.6 (9)
Without semicolon print the statement.Jeevanrao 5.6 (9)
Short program to print Hello World! without semicolonAli Nawkhas Murad 5.6 (9)
Without semicolon print the statement.Jeevanrao 5.6 (9)
Menu driven program in c programmingcampus 5.6 (9)
Eventhandling macro for classesToolsDevler 5.6 (9)
code to shut a computer with windows XPbenn mutisya 5.6 (9)
Output console text with type-writer effect.Michael Brandon Miller 5.6 (9)
A portable card deck class with shufflingSlyMaelstrom C++ANSI5.6 (9)
this one is better because a potential overflow (of the + operation) is avoided 5.6 (9)
Next 30
Previous 30

Add a snippet!