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)
Another way to swap 2 numbersMaganti Venkatesh C or C++ANSI4.5 (52)
Find the Prime Factors of Given NumberSHINE AIYYAPPAN CANSI4.1 (51)
Function pointer to member function of classselvam C++ANSI4.0 (39)
An example use of a function pointerJayesh C++ANSI3.5 (41)
Another merge sort of integer listManoj CANSI3.5 (40)
Convert an integer into binary representationElabed Soufiane CANSI3.4 (43)
Macro to swap nibble of BYTET Sailesh C or C++ANSI3.3 (41)
how to implement strlwr in CSyed Rafey Husain C or C++ANSI3.2 (40)
This C code assigns codes to a maximum of 10 charsAbhishek H.Dwivedi C or C++Windows3.1 (34)
Merge sort of an integer listBibhubrata Narendra C or C++ANSI2.9 (37)
Implementing a directory listing on LinuxJoshith C*nix2.9 (37)
Find the minimum distance between two linesGiacomo C or C++ANSI2.9 (35)
Creating, printing and free linked listsSyed Rafey Husain CANSI2.9 (35)
Print variables with file and line number for debuggingmike lear C++ANSI2.7 (36)
Dynamically Allocating a Multidimensional ArrayJared Hendrickson CANSI2.5 (35)
Calculates 1 variable statisticsPaul Kennedy C++ANSI2.3 (33)
Previous 30

Add a snippet!