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)
Use const variables as function parameters when pobeyonddc 5.9
Use virtual functions instead of type checkingSajan 5.9
Avoid stl set non-const iteratorsIgor 5.9
Declaration of abstract class in c++Ali Nawkhas Murad 5.9
Prefer pre-increment and pre-decrementKarl 5.9
pre & post increment & decrement operators jay 5.9
Use STL containers instead of C arraysSang-drax 5.9
Modifying const variablesWiro Sableng 5.9
Pointer Memory allocationKrishnamoorthi 5.9
Better enumsBrent 5.9
C++ new does not return 0 on failure!Are R. Svendsen 5.8
Turn on all compiler warningsMaragato 5.8
Avoid memory wastageArthi 5.8
Operator Associativity and HierarchyAvinash 5.8
Use multiple filesThantos 5.8
Use <constant> == <value>Webmaster 5.8
Commenting out code with the preprocessorWebmaster 5.7
Goto vs. Higher-level control structuresSean 5.7
Member Functions are inline by default (C++)Ash 5.7
beware of loop invarinatsIain 5.7
Be careful of Magic behaviour due to compilers manik 5.7
Comment!VOX 5.7
Don't use fflush(stdin)Shakti 5.6
Get a copy of the standardThantos 5.6
Turn off optimization when debuggingAshok Kumar 5.6
Use templates to prevent memory leakageKunal 5.6
char *pa; and char a[];avdtech 5.6
take advantage of array indiciesDave 5.6
Safely using strncpyoliv29 5.6
Use the Appropriate VariablesMahesh Kumar.S 5.5

Next 30
Previous 30

Help your fellow programmers! Add a tip!