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)
Macro to swap nibble of BYTET Sailesh C or C++ANSI4.1 (50)
Checking for powers of twoWebmaster C or C++ANSI5.7 (333)
Simple integer binary search example source codeSyed Rafey Husain C or C++ANSI2.3 (33)
how to implement strlwr in CSyed Rafey Husain C or C++ANSI3.8 (47)
binary tree creation, traversal and searchSyed Rafey Husain C or C++ANSI6.0 (209)
An example of simple stack using linked lists.Ali Nawkhas Murad C++ANSI6.4 (481)
An example of simple priority queue using linked lists.Ali Nawkhas Murad C++ANSI5.3 (140)
binary addition using stack in STLanmol C++ANSI5.1 (102)
A simple example of hashtableAli Nawkhas Murad C++ANSI5.6 (154)
Simple example for using thousand separator (,)Ali Nawkhas Murad C++ANSI4.8 (96)
Conversions between number systemsAli Nawkhas Murad C++ANSI5.6 (139)
ASCII table generatorAbdul Haseeb Mir C++ANSI6.5 (509)
Distanceprog-bman C++ANSI5.4 (189)
A simple double linked list using OOP techniquesAli Nawkhas Murad C++ANSI5.4 (198)
The standard ASCII table generator.Ali Nawkhas Murad C++ANSI6.4 (456)
Calandar generator (based on snippet by Joe) printing a calendar for any yearTyler Veness C++ANSI6.6 (456)
An example use of a function pointerJayesh C++ANSI3.6 (43)
Print variables with file and line number for debuggingmike lear C++ANSI2.6 (37)
Calandar generator printing a full calendar for any yearJoe C++ANSI6.3 (327)
Templated queue classAli Nawkhas Murad C++ANSI5.7 (135)
Example of polymorphismAli Nawkhas Murad C++ANSI5.6 (213)
View the format of IEEE 754 floating point numbersAli Nawkhas Murad C++ANSI6.5 (470)
An example of using the same variable name in different scopesAli Nawkhas Murad C++ANSI4.9 (104)
Function pointer to member function of classselvam C++ANSI4 (40)
Find size and storage capacity of primitive data typesAli Nawkhas Murad C++ANSI5.2 (113)
View the contents of a directoryfinnepower C++Windows5.5 (209)
Permutation GeneratorTreenef C++ANSI5.6 (487)
Three Dimension Coordinate Systems ConverterAli Nawkhas Murad C++ANSI5.3 (111)
friend function exampleAli Nawkhas Murad C++ANSI6.6 (445)
Calculates 1 variable statisticsPaul Kennedy C++ANSI2.5 (35)
Next 30
Previous 30

Add a snippet!