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 5.6 (9)
A portable card deck class with shufflingSlyMaelstrom C++ANSI5.6 (9)
simple StopWatch with roundtrip timeNickMa 5.6 (9)
Palindrome FunctionJason Weeks 5.6 (9)
String FunctionsDominic Vonk 5.6 (9)
Distanceprog-bman C++ANSI5.5 (184)
Macro to swap nibble of BYTET Sailesh C or C++ANSI5.4 (10)
Simple integer binary search example source codeSyed Rafey Husain C or C++ANSI5.3 (6)
Integer subset generatortreenef C++ANSI5.3 (10)
using struct tm, time_t, and time to create a simple clockDieter Manstein CANSI5.3 (11)
Find The Sum of Digits of a Given NumberSHINE AIYYAPPAN CANSI5.2 (57)
Shorter version of gotoxyNedeljko CLinux5.1 (59)
Count number of bits in a numberNaren Bala C or C++ANSI5.1 (9)
A singly linked list with a sentinel implementationyzb3 CANSI4.9 (21)
Function pointer to member function of classselvam C++ANSI4.0 (39)
This C code assigns codes to a maximum of 10 charsAbhishek H.Dwivedi C or C++Windows2.9 (33)
Previous 30

Add a snippet!