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)
Menu driven program in c programmingcampus 6.0 (5)
Merge sort of an integer listBibhubrata Narendra C or C++ANSI6.3 (12)
One line swap of integersabhilash C or C++ANSI8.2 (99)
Output console text with type-writer effect.Michael Brandon Miller 6.0 (5)
Palindrome FunctionJason Weeks 5.3 (4)
Pascal's TriangleAli Nawkhas Murad C++ANSI8.4 (81)
Pascals Triangle Using Combination Function of IndicesSHINE AIYYAPPAN CANSI8.5 (63)
Permutation GeneratorTreenef C++ANSI7.4 (333)
Print variables with file and line number for debuggingmike lear C++ANSI6.1 (12)
Quick-sort using vector and iterator in STLJianbao Tao 5.3 (4)
Rectangle Collision DetectionDavid Nielsen C or C++ANSI6.1 (171)
Short program to print Hello World! without semicolonAli Nawkhas Murad 6.0 (5)
Shorter version of gotoxyNedeljko CLinux7.9 (34)
similar to gotoxy; minimal screen control for wyseMike Kinney C or C++ANSI5.8 (156)
Simple example for using thousand separator (,)Ali Nawkhas Murad C++ANSI8.8 (38)
Simple integer binary search example source codeSyed Rafey Husain C or C++ANSI5.3 (6)
Simple linked list implementationyzb3 CANSI7.7 (60)
simple StopWatch with roundtrip timeNickMa 5.3 (4)
Simple swapping heapsortyzb3 C or C++ANSI8.6 (74)
Simple Windows Socket Server ExampleJahan Addison C++Windows7.4 (55)
Singly linked list - insert, remove, add, countGirish Amara CANSI7.6 (473)
String FunctionsDominic Vonk 5.3 (4)
String FunctionsDominic Vonk 5.3 (4)
string to bitstring, bitstring to stringEsa Karjalainen CANSI7.4 (18)
Template Calculatorprog-bman C++ANSI6.1 (275)
Templated queue classAli Nawkhas Murad C++ANSI8.6 (60)
Templated stack class Ali Nawkhas Murad C++ANSI8.8 (50)
The standard ASCII table generator.Ali Nawkhas Murad C++ANSI8.7 (51)
This C code assigns codes to a maximum of 10 charsAbhishek H.Dwivedi C or C++Windows8.1 (9)
This C code recursively sorts an array of upto 20Abhishek H.Dwivedi C or C++ANSI5.8 (209)
Next 30
Previous 30

Add a snippet!