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)
Dynamically Allocating a Multidimensional ArrayJared Hendrickson CANSI6.2 (10)
xor (en/de)cryption using a key fileyzb3 CANSI6.2 (74)
Find size and storage capacity of primitive data typesAli Nawkhas Murad C++ANSI6.2 (78)
Rectangle Collision DetectionDavid Nielsen C or C++ANSI6.1 (172)
A code template for OpenGL / GLUTPerspective C or C++ANSI6.1 (230)
useful macros, functions and tricksyzb3 CANSI6.1 (71)
dynamically create and initialise 4d arrayG.Watt.Porteous CANSI6.1 (72)
View the contents of a directoryfinnepower C++Windows6.1 (184)
Example of polymorphismAli Nawkhas Murad C++ANSI6.1 (147)
a short BubbleSort algoritm for Integer ArraysMajor_Small C or C++ANSI6.1 (203)
An example of using the same variable name in different scopesAli Nawkhas Murad C++ANSI6.1 (77)
Template Calculatorprog-bman C++ANSI6.1 (276)
Print variables with file and line number for debuggingmike lear C++ANSI6.1 (12)
Initial values for static multidimensional arrayAli Nawkhas Murad C or C++ANSI6.1 (76)
An example of simple stack using linked lists.Ali Nawkhas Murad C++ANSI6.1 (90)
how to implement strlwr in CSyed Rafey Husain C or C++ANSI5.9 (14)
Validate Longitudinal Redundancy Checksum (LRC)Darko Kolaković C or C++ANSI5.9 (138)
Without semicolon print the statement.Jeevanrao 5.9 (10)
Without semicolon print the statement.Jeevanrao 5.9 (10)
code to shut a computer with windows XPbenn mutisya 5.9 (10)
Menu driven program in c programmingcampus 5.9 (10)
Short program to print Hello World! without semicolonAli Nawkhas Murad 5.9 (10)
Output console text with type-writer effect.Michael Brandon Miller 5.9 (10)
Eventhandling macro for classesToolsDevler 5.9 (10)
Create a new file under linuxChol Nhial 5.9 (10)
this one is better because a potential overflow (of the + operation) is avoided 5.9 (10)
Tic-TacToeptrs 5.9 (10)
Integer Partitions from 1 to NChristopher Brown 5.9 (10)
ASCII table generatorAbdul Haseeb Mir C++ANSI5.9 (79)
euler approximation methoderic mbakop C or C++ANSI5.9 (256)
Next 30
Previous 30

Add a snippet!