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 8.6 (348)
Merge sort of an integer listBibhubrata Narendra C or C++ANSI2.9 (37)
One line swap of integersabhilash C or C++ANSI5.3 (196)
Output console text with type-writer effect.Michael Brandon Miller 8.6 (348)
Palindrome FunctionJason Weeks 8.6 (347)
Pascal's TriangleAli Nawkhas Murad C++ANSI7.1 (429)
Pascals Triangle Using Combination Function of IndicesSHINE AIYYAPPAN CANSI7.0 (411)
Permutation GeneratorTreenef C++ANSI5.8 (464)
Print variables with file and line number for debuggingmike lear C++ANSI2.7 (36)
Quick-sort using vector and iterator in STLJianbao Tao 8.6 (347)
Rectangle Collision DetectionDavid Nielsen C or C++ANSI5.5 (197)
Short program to print Hello World! without semicolonAli Nawkhas Murad 8.6 (348)
Shorter version of gotoxyNedeljko CLinux5.1 (59)
similar to gotoxy; minimal screen control for wyseMike Kinney C or C++ANSI5.1 (180)
Simple example for using thousand separator (,)Ali Nawkhas Murad C++ANSI4.5 (89)
Simple integer binary search example source codeSyed Rafey Husain C or C++ANSI5.3 (6)
Simple linked list implementationyzb3 CANSI5.1 (124)
simple StopWatch with roundtrip timeNickMa 8.6 (347)
Simple swapping heapsortyzb3 C or C++ANSI5.9 (134)
Simple Windows Socket Server ExampleJahan Addison C++Windows5.1 (134)
Singly linked list - insert, remove, add, countGirish Amara CANSI7.2 (1323)
String FunctionsDominic Vonk 8.6 (347)
String FunctionsDominic Vonk 8.6 (347)
string to bitstring, bitstring to stringEsa Karjalainen CANSI4.2 (46)
Template Calculatorprog-bman C++ANSI5.4 (331)
Templated queue classAli Nawkhas Murad C++ANSI5.6 (117)
Templated stack class Ali Nawkhas Murad C++ANSI7.4 (369)
The standard ASCII table generator.Ali Nawkhas Murad C++ANSI7.3 (355)
This C code assigns codes to a maximum of 10 charsAbhishek H.Dwivedi C or C++Windows3.1 (34)
This C code recursively sorts an array of upto 20Abhishek H.Dwivedi C or C++ANSI5.3 (236)
Next 30
Previous 30

Add a snippet!