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)
Shorter version of gotoxyNedeljko CLinux5.1 (60)
Find the number of CPU Cores, for Windows, Mac or LinuxDirk-Jan Kroon C or C++Multiple5.1 (62)
Color header for Windows that integrates with coutSang-drax C++Windows5.4 (257)
A very simple frames per second functionJeff Verkoeyen C or C++Windows5.3 (232)
GetLastError error lookup toolKen Fitlike CWindows5.2 (210)
This C code assigns codes to a maximum of 10 charsAbhishek H.Dwivedi C or C++Windows3.1 (35)
View the contents of a directoryfinnepower C++Windows5.5 (209)
Simple Windows Socket Server ExampleJahan Addison C++Windows5.3 (142)
Convert NTSTATUS code to Win32 errorIan Abbott C or C++Windows4.9 (97)
This is Trigonometry Table made AlhamdulillahAbdul Haseeb Mir CWindows6.4 (393)
Previous 30

Add a snippet!