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)
GotoXYStack Overflow C*nix6.3 (338)
This C code uses the merge sort algorithm to sortAbhishek H.Dwivedi C or C++ANSI6.3 (568)
Three ways to do a swapDavid Nielsen C or C++ANSI6.3 (319)
Another merge sort of integer listManoj CANSI6.3 (11)
Merge sort of an integer listBibhubrata Narendra C or C++ANSI6.3 (12)
Implementing a directory listing on LinuxJoshith C*nix6.3 (12)
Dynamically Allocating a Multidimensional ArrayJared Hendrickson CANSI6.2 (10)
Rectangle Collision DetectionDavid Nielsen C or C++ANSI6.1 (171)
Print variables with file and line number for debuggingmike lear C++ANSI6.1 (12)
a short BubbleSort algoritm for Integer ArraysMajor_Small C or C++ANSI6.1 (202)
Template Calculatorprog-bman C++ANSI6.1 (275)
A code template for OpenGL / GLUTPerspective C or C++ANSI6.0 (220)
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 (137)
Macro to swap nibble of BYTET Sailesh C or C++ANSI5.9 (9)
euler approximation methoderic mbakop C or C++ANSI5.9 (256)
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)
This C code recursively sorts an array of upto 20Abhishek H.Dwivedi C or C++ANSI5.8 (209)
A very simple frames per second functionJeff Verkoeyen C or C++Windows5.7 (195)
Calculates the closest point to a segmentAdrián Deccico C or C++ANSI5.7 (133)
Short program to print Hello World! without semicolonAli Nawkhas Murad 5.7 (6)
code to shut a computer with windows XPbenn mutisya 5.7 (6)
Eventhandling macro for classesToolsDevler 5.7 (6)
Tic-TacToeptrs 5.7 (6)
Without semicolon print the statement.Jeevanrao 5.7 (6)
Without semicolon print the statement.Jeevanrao 5.7 (6)
Menu driven program in c programmingcampus 5.7 (6)
Create a new file under linuxChol Nhial 5.7 (6)
Next 30
Previous 30

Add a snippet!