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)
compiler tipJulian Sutherland 5.8
Code Optimization TipsBasker Swaminathan 5.8
Member Functions are inline by default (C++)Ash 5.8
Multiply rather than DivideReese Moore 5.8
Use <constant> == <value>Webmaster 5.8
Use multiple filesThantos 5.7
Commenting out code with the preprocessorWebmaster 5.7
Make libraries for yourselfValseedian 5.7
Goto vs. Higher-level control structuresSean 5.7
swap with out using temporaryraghava 5.7
Be organisedProphet-Ex 5.7
Be careful of Magic behaviour due to compilers manik 5.7
Free The Memory That You UseUdhaya Kumar.D 5.7
do not use printf without %s to print a stringpavan kumar 5.7
Never do unary minus on sizeofVaibhav 5.7
beware of loop invarinatsIain 5.7
When optimizing code, focus on algorithms firstAlex Allain 5.7
.c is used for c while .cpp is used for c++G.P. 5.7
The many meanings of NULLRajat Kochhar 5.7
gets() is bad.Sean 5.7
Do NOT always check for NULL! (C++)Kevin Lam 5.7
Comment!VOX 5.7
Initialise all variablesJia.Lu 5.6
Don't use fflush(stdin)Shakti 5.6
initalization of objectsmohit dhawan 5.6
Get a copy of the standardThantos 5.6
Be careful when storing pointers inside unionssingam kiran reddy 5.6
Run code in Different compilersNaren Varma 5.6
getchar() returns an intRob 5.6
Turn off optimization when debuggingAshok Kumar 5.6

Next 30
Previous 30

Help your fellow programmers! Add a tip!