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)
Integer subset generatortreenef C++ANSI4.9 (11)
Calandar generator (based on snippet by Joe) printing a calendar for any yearTyler Veness C++ANSI6.6 (457)
Checking for powers of twoWebmaster C or C++ANSI5.7 (333)
Simple swapping heapsortyzb3 C or C++ANSI5.1 (162)
xor (en/de)cryption using a key fileyzb3 CANSI5.5 (117)
Failproof xor (en/de)cryptionyzb3 CANSI5.0 (152)
Simple linked list implementationyzb3 CANSI5.4 (138)
useful macros, functions and tricksyzb3 CANSI5.5 (116)
Useful string functionsyzb3 CANSI5.8 (159)
A singly linked list with a sentinel implementationyzb3 CANSI4.7 (22)
Previous 30

Add a snippet!