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)
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)
Initial values for static multidimensional arrayAli Nawkhas Murad C or C++ANSI4.8 (101)
xor (en/de)cryption using a key fileyzb3 CANSI5.5 (117)
Failproof xor (en/de)cryptionyzb3 CANSI5.0 (152)
Examples of dynamic multidimensional arraysAli Nawkhas Murad C++ANSI5.8 (135)
Simple linked list implementationyzb3 CANSI5.4 (138)
Word wrap functionSean Hubbard CANSI5.3 (163)
An example of Exception HandlingAli Nawkhas Murad C++ANSI4.6 (94)
Pascal's TriangleAli Nawkhas Murad C++ANSI6.3 (535)
useful macros, functions and tricksyzb3 CANSI5.5 (116)
Templated stack class Ali Nawkhas Murad C++ANSI9.6 (4677)
Three Dimension Coordinate Systems ConverterAli Nawkhas Murad C++ANSI5.3 (111)
friend function exampleAli Nawkhas Murad C++ANSI6.5 (443)
The standard ASCII table generator.Ali Nawkhas Murad C++ANSI6.4 (455)
A simple double linked list using OOP techniquesAli Nawkhas Murad C++ANSI5.3 (197)
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 (139)
Useful string functionsyzb3 CANSI5.8 (157)
A simple example of hashtableAli Nawkhas Murad C++ANSI5.6 (154)
A singly linked list with a sentinel implementationyzb3 CANSI4.7 (22)
binary addition using stack in STLanmol C++ANSI5.1 (102)
Simple example for using thousand separator (,)Ali Nawkhas Murad C++ANSI4.8 (96)
Conversions between number systemsAli Nawkhas Murad C++ANSI5.6 (136)
ASCII table generatorAbdul Haseeb Mir C++ANSI6.5 (505)
dynamically create and initialise 4d arrayG.Watt.Porteous CANSI4.9 (98)
Pascals Triangle Using Combination Function of IndicesSHINE AIYYAPPAN CANSI6.3 (517)
Find the Prime Factors of Given NumberSHINE AIYYAPPAN CANSI4.0 (52)
Find The Sum of Digits of a Given NumberSHINE AIYYAPPAN CANSI5.1 (60)
Next 30
Previous 30

Add a snippet!