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)
Merge sort of an integer listBibhubrata Narendra C or C++ANSI2.9 (38)
One line swap of integersabhilash C or C++ANSI5.4 (206)
Output console text with type-writer effect.Michael Brandon Miller 7.4 (501)
Palindrome FunctionJason Weeks 7.4 (501)
Pascal's TriangleAli Nawkhas Murad C++ANSI6.3 (535)
Pascals Triangle Using Combination Function of IndicesSHINE AIYYAPPAN CANSI6.3 (517)
Permutation GeneratorTreenef C++ANSI5.6 (487)
Print variables with file and line number for debuggingmike lear C++ANSI2.6 (37)
Quick-sort using vector and iterator in STLJianbao Tao 7.4 (497)
Rectangle Collision DetectionDavid Nielsen C or C++ANSI5.5 (202)
Shorter version of gotoxyNedeljko CLinux5.1 (60)
similar to gotoxy; minimal screen control for wyseMike Kinney C or C++ANSI5.1 (181)
Simple example for using thousand separator (,)Ali Nawkhas Murad C++ANSI4.8 (96)
Simple integer binary search example source codeSyed Rafey Husain C or C++ANSI2.3 (33)
Simple linked list implementationyzb3 CANSI5.4 (138)
simple StopWatch with roundtrip timeNickMa 7.4 (502)
Simple swapping heapsortyzb3 C or C++ANSI5.1 (162)
Simple Windows Socket Server ExampleJahan Addison C++Windows5.4 (148)
Singly linked list - insert, remove, add, countGirish Amara CANSI7.2 (2162)
String FunctionsDominic Vonk 7.4 (499)
string to bitstring, bitstring to stringEsa Karjalainen CANSI4.8 (54)
Template Calculatorprog-bman C++ANSI5.5 (346)
Templated queue classAli Nawkhas Murad C++ANSI5.7 (131)
Templated stack class Ali Nawkhas Murad C++ANSI9.6 (4677)
The standard ASCII table generator.Ali Nawkhas Murad C++ANSI6.4 (455)
This C code assigns codes to a maximum of 10 charsAbhishek H.Dwivedi C or C++Windows3.1 (35)
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)
This is Trigonometry Table made AlhamdulillahAbdul Haseeb Mir CWindows6.4 (394)
Three Dimension Coordinate Systems ConverterAli Nawkhas Murad C++ANSI5.3 (111)
Next 30
Previous 30

Add a snippet!