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)
The standard ASCII table generator.Ali Murad C++ANSI9.1 (28)
dynamically create and initialise 4d arrayG.Watt.Porteous CANSI9.0 (19)
View the format of IEEE 754 floating point numbersAli Murad C++ANSI9.0 (35)
Failproof xor (en/de)cryptionyzb3 CANSI8.9 (37)
Pascals Triangle Using Combination Function of IndicesSHINE AIYYAPPAN CANSI8.9 (30)
An example of Exception HandlingAli Murad C++ANSI8.9 (22)
Templated stack class Ali Murad C++ANSI8.9 (28)
Example of polymorphismAli Murad C++ANSI8.8 (38)
xor (en/de)cryption using a key fileyzb3 CANSI8.7 (26)
Convert NTSTATUS code to Win32 errorIan Abbott C or C++Windows8.7 (23)
binary addition using stack in STLanmol C++ANSI8.7 (22)
Three Dimension Coordinate Systems ConverterAli Murad C++ANSI8.7 (6)
Examples of dynamic multidimensional arraysAli Murad C++ANSI8.7 (38)
Templated queue classAli Murad C++ANSI8.6 (36)
Simple swapping heapsortyzb3 C or C++ANSI8.6 (48)
useful macros, functions and tricksyzb3 CANSI8.6 (26)
Pascal's TriangleAli Murad C++ANSI8.5 (48)
Word wrap functionSean Hubbard CANSI8.5 (33)
Initial values for static multidimensional arrayAli Murad C or C++ANSI8.5 (33)
An example of using the same variable name in different scopesAli Murad C++ANSI8.5 (35)
Useful string functionsyzb3 CANSI8.4 (41)
Find size and storage capacity of primitive data typesAli Murad C++ANSI8.4 (32)
Simple linked list implementationyzb3 CANSI8.4 (28)
Simple example for using thousand separator (,)Ali Murad C++ANSI8.4 (17)
Conversions between number systemsAli Murad C++ANSI8.3 (27)
ASCII table generatorAbdul Haseeb Mir C++ANSI8.3 (12)
An example of simple stack using linked lists.Ali Murad C++ANSI8.1 (27)
One line swap of integersabhilash C or C++ANSI8.1 (67)
An example of simple priority queue using linked lists.Ali Murad C++ANSI8.1 (29)
A simple example of hashtableAli Murad C++ANSI8.1 (37)
Next 30

Add a snippet!