C and C++ Programming Tips

Welcome to Cprogramming.com's repository or tips for programming in C and C++. Peruse the archives or add your own tips for others to use!

Sort by clicking on any of the headers.

TipAuthorRating (votes)
Better enumsBrent 8.8
Make pointer and reference arguments constAkshay 8.5
The power of scanf()Joanna 8.5
Using _strtime and _strdate to get the timeAli Jafar 8.4
Set the most significant bit of an int Alphonse Ajayan 8.4
Use virtual functions instead of type checkingSajan 8.4
In C++ a pure abstract base class is a contractMarty Corbett 8.4
Avoid stl set non-const iteratorsIgor 8.4
What is a friend function?Ali Nawkhas Murad 8.3
difference between float and doubleankit panwar 8.2
Count number of bits in an integer.Anjani Kumar Mishra 8.2
Long variable namesCarl 8.2
gets is dangerouscarl johnson 8.1
Declaration of abstract class in c++Ali Nawkhas Murad 8.0
swap with out using temporaryraghava 8.0
Differences between class and structAli Nawkhas Murad 8.0
Passing array elements to functionsUmer khan 7.9
Benefits of inline functionsAli Nawkhas Murad 7.8
Passing a pointer to a functionIrfaan Kamo 7.8
Display Date and Time in C++Govind 7.7
Copy constructorAli Nawkhas Murad 7.7
do not use printf without %s to print a stringpavan kumar 7.6
logical error on divisionM.Kumaran 7.5
Temporariless SwapGuille 7.5
Rounding to an IntegerGorn 7.4
Why you can't dereference a void* pointerashish mathur 7.4
Comparisons in C\C++Nikitas Angelinas 7.4
assert() yourself!Kevin Lam 7.4
Don't use strlen in a loop condition.anonytmouse 7.4
When optimizing code, focus on algorithms firstAlex Allain 7.3

Next 30

Help your fellow programmers! Add a tip!