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)
This C code uses the merge sort algorithm to sortAbhishek H.Dwivedi C or C++ANSI6.3 (568)
This is Trigonometry Table made AlhamdulillahAbdul Haseeb Mir CWindows7.6 (7)
this one is better because a potential overflow (of the + operation) is avoided 5.7 (6)
Three Dimension Coordinate Systems ConverterAli Nawkhas Murad C++ANSI9.2 (46)
Three ways to do a swapDavid Nielsen C or C++ANSI6.3 (319)
Tic-TacToeptrs 5.7 (6)
useful macros, functions and tricksyzb3 CANSI8.7 (45)
Useful string functionsyzb3 CANSI7.9 (81)
using struct tm, time_t, and time to create a simple clockDieter Manstein CANSI5.3 (11)
Validate Longitudinal Redundancy Checksum (LRC)Darko Kolaković C or C++ANSI5.9 (137)
View the contents of a directoryfinnepower C++Windows6.9 (160)
View the format of IEEE 754 floating point numbersAli Nawkhas Murad C++ANSI9.0 (63)
Without semicolon print the statement.Jeevanrao 5.7 (6)
Without semicolon print the statement.Jeevanrao 5.7 (6)
Word wrap functionSean Hubbard CANSI8.4 (60)
xor (en/de)cryption using a key fileyzb3 CANSI8.8 (47)
Previous 30

Add a snippet!