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)
how to implement strlwr in CSyed Rafey Husain C or C++ANSI5.9 (14)
Knuth-Morris-Pratt (KMP) String Search AlgorithmSyed Rafey Husain C or C++ANSI7.2 (414)
binary tree creation, traversal and searchSyed Rafey Husain C or C++ANSI4.6 (65)
Macro to swap nibble of BYTET Sailesh C or C++ANSI5.4 (10)
Eventhandling macro for classesToolsDevler 5.9 (10)
Permutation GeneratorTreenef C++ANSI7.0 (360)
Integer subset generatortreenef C++ANSI5.3 (10)
Calandar generator (based on snippet by Joe) printing a calendar for any yearTyler Veness C++ANSI5.6 (74)
Checking for powers of twoWebmaster C or C++ANSI6.5 (271)
useful macros, functions and tricksyzb3 CANSI6.1 (71)
Simple linked list implementationyzb3 CANSI5.8 (92)
Useful string functionsyzb3 CANSI6.4 (108)
Failproof xor (en/de)cryptionyzb3 CANSI5.5 (113)
xor (en/de)cryption using a key fileyzb3 CANSI6.2 (74)
Simple swapping heapsortyzb3 C or C++ANSI5.7 (124)
A singly linked list with a sentinel implementationyzb3 CANSI4.9 (21)
Previous 30

Add a snippet!