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)
String FunctionsDominic Vonk 7.4 (498)
Palindrome FunctionJason Weeks 7.4 (500)
Quick-sort using vector and iterator in STLJianbao Tao 7.4 (496)
Menu driven program in c programmingcampus 7.4 (532)
Integer Partitions from 1 to NChristopher Brown 7.4 (501)
Output console text with type-writer effect.Michael Brandon Miller 7.4 (498)
Eventhandling macro for classesToolsDevler 7.4 (498)
Create a new file under linuxChol Nhial 7.4 (502)
Tic-TacToeptrs 7.4 (498)
simple StopWatch with roundtrip timeNickMa 7.4 (499)
Implementing a directory listing on LinuxJoshith C*nix4.1 (47)
GotoXYStack Overflow C*nix5.6 (443)
a simple clockrichmond caesar CANSI5.9 (774)
Three ways to do a swapDavid Nielsen C or C++ANSI5.6 (374)
Distanceprog-bman C++ANSI5.4 (189)
Count number of bits in a numberNaren Bala C or C++ANSI4.7 (10)
Dynamically Allocating a Multidimensional ArrayJared Hendrickson CANSI2.4 (36)
Calculates 1 variable statisticsPaul Kennedy C++ANSI2.5 (35)
Knuth-Morris-Pratt (KMP) String Search AlgorithmSyed Rafey Husain C or C++ANSI6.6 (871)
Creating, printing and free linked listsSyed Rafey Husain CANSI2.9 (36)
euler approximation methoderic mbakop C or C++ANSI5.4 (281)
Validate Longitudinal Redundancy Checksum (LRC)Darko Kolaković C or C++ANSI5.3 (168)
A portable card deck class with shufflingSlyMaelstrom C++ANSI6.8 (399)
Permutation GeneratorTreenef C++ANSI5.6 (487)
Integer subset generatortreenef C++ANSI4.9 (11)
This C code recursively sorts an array of upto 20Abhishek H.Dwivedi C or C++ANSI5.3 (237)
This C code uses the merge sort algorithm to sortAbhishek H.Dwivedi C or C++ANSI5.5 (671)
A game setup for DirectXPaul D C or C++ANSI5.4 (287)
A function to reverse an integer arrayMajor_Small C or C++ANSI5.5 (481)
Checking for powers of twoWebmaster C or C++ANSI5.7 (333)
Next 30

Add a snippet!