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)
Convert an integer into binary representationElabed Soufiane CANSI5.0 (91)
Calculates 1 variable statisticsPaul Kennedy C++ANSI4.9 (84)
Find the Prime Factors of Given NumberSHINE AIYYAPPAN CANSI4.8 (88)
Creating, printing and free linked listsSyed Rafey Husain CANSI4.8 (78)
This C code assigns codes to a maximum of 10 charsAbhishek H.Dwivedi C or C++Windows4.6 (74)
Merge sort of an integer listBibhubrata Narendra C or C++ANSI4.6 (79)
Dynamically Allocating a Multidimensional ArrayJared Hendrickson CANSI4.5 (77)
Find the minimum distance between two linesGiacomo C or C++ANSI4.3 (78)
Simple integer binary search example source codeSyed Rafey Husain C or C++ANSI4.2 (72)
Print variables with file and line number for debuggingmike lear C++ANSI4.1 (81)
Previous 30