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++ANSI5.3 (10)
Calandar generator (based on snippet by Joe) printing a calendar for any yearTyler Veness C++ANSI7.3 (396)
Checking for powers of twoWebmaster C or C++ANSI5.7 (323)
Useful string functionsyzb3 CANSI5.7 (143)
Failproof xor (en/de)cryptionyzb3 CANSI5.7 (127)
xor (en/de)cryption using a key fileyzb3 CANSI5.5 (116)
useful macros, functions and tricksyzb3 CANSI5.5 (113)
Simple swapping heapsortyzb3 C or C++ANSI5.9 (136)
A singly linked list with a sentinel implementationyzb3 CANSI4.9 (21)
Simple linked list implementationyzb3 CANSI5.5 (137)
Previous 30

Add a snippet!