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)
simple StopWatch with roundtrip timeNickMa 7.4 (502)
Menu driven program in c programmingcampus 7.4 (544)
Create a new file under linuxChol Nhial 7.4 (503)
Palindrome FunctionJason Weeks 7.4 (501)
Quick-sort using vector and iterator in STLJianbao Tao 7.4 (497)
Output console text with type-writer effect.Michael Brandon Miller 7.4 (501)
Integer Partitions from 1 to NChristopher Brown 7.4 (502)
Tic-TacToeptrs 7.4 (502)
Eventhandling macro for classesToolsDevler 7.4 (499)
String FunctionsDominic Vonk 7.4 (499)
Implementing a directory listing on LinuxJoshith C*nix4.1 (47)
dynamically create and initialise 4d arrayG.Watt.Porteous CANSI4.9 (98)
a simple clockrichmond caesar CANSI5.9 (806)
GetLastError error lookup toolKen Fitlike CWindows5.2 (210)
useful macros, functions and tricksyzb3 CANSI5.5 (116)
Find the Prime Factors of Given NumberSHINE AIYYAPPAN CANSI4.0 (52)
Dynamically Allocating a Multidimensional ArrayJared Hendrickson CANSI2.4 (36)
Convert an integer into binary representationElabed Soufiane CANSI3.4 (46)
Creating, printing and free linked listsSyed Rafey Husain CANSI2.9 (36)
Find The Sum of Digits of a Given NumberSHINE AIYYAPPAN CANSI5.1 (60)
Another merge sort of integer listManoj CANSI4.1 (47)
A singly linked list with a sentinel implementationyzb3 CANSI4.7 (22)
GotoXYStack Overflow C*nix5.6 (444)
Pascals Triangle Using Combination Function of IndicesSHINE AIYYAPPAN CANSI6.3 (517)
Useful string functionsyzb3 CANSI5.8 (157)
using struct tm, time_t, and time to create a simple clockDieter Manstein CANSI5.2 (13)
Shorter version of gotoxyNedeljko CLinux5.1 (60)
xor (en/de)cryption using a key fileyzb3 CANSI5.5 (117)
Simple linked list implementationyzb3 CANSI5.4 (138)
Word wrap functionSean Hubbard CANSI5.3 (163)
Next 30

Add a snippet!