Sunday 4 December 2011

C and C++ Programming Tips


TipAuthorRating (votes)
gets is dangerouscarl johnson7.6
do not use printf without %s to print a stringpavan kumar7.5
Temporariless SwapGuille7.4
Comparisons in C\C++Nikitas Angelinas7.3
Rounding to an IntegerGorn7.3
logical error on divisionM.Kumaran7.3
assert() yourself!Kevin Lam7.2
Always write if statements with bracesWebmaster7.1
Don't use strlen in a loop condition.anonytmouse7.0
When optimizing code, focus on algorithms firstAlex Allain7.0
Passing array elements to functionsUmer khan7.0
difference between int* p and int *p declarationomprakash mishra6.9
Multiply rather than DivideReese Moore6.9
Solve Any Compiler Error EasilyWajahat Karim6.9
Better coding style for comparisonnids6.9
Standard Loop ProgressionDazzle6.9
The power of scanf()Joanna6.8
Common Optimization TipsTravis Fischer6.8
Keep a cool head when programmingSentralia6.8
High performance loopingRachana6.8
Keep fit to program betterLuna Man6.8
Pointer Tips :-)Jatin Gandhi6.8
Converting numbers to StringsWebmaster6.7
C++ new does not return 0 on failure!Are R. Svendsen6.7
Initialise all variables before useMounish6.7
Be organisedProphet-Ex6.7
Never do unary minus on sizeofVaibhav6.7
Pointer Memory allocationKrishnamoorthi6.7
Fast multiplicationJean-François Geyelin6.7
Use ++ and --Subyraj P.S6.7
Effective Modularity in ProgrammingSharma PCS6.6
Flowchartsayyapparaju6.6
The many meanings of NULLRajat Kochhar6.6
Safely using strncpyoliv296.5
Avoid void main()Webmaster6.5
initalization of objectsmohit dhawan6.5
Dont't use scanf() when reading sentencesRomnico6.5
clean up after cin (C++)Major_Small6.5
Write it out on paperrakesh kumar6.5
loop conditionKrishna6.4
LogicHardi Pertel6.4
Be careful when storing pointers inside unionssingam kiran reddy6.4
Code Optimization TipsBasker Swaminathan6.4
Be careful about array size when u are using strcpBhushan Verma6.4
Clever ways to avoid using if statementsA. Karthick Pandia Samy6.4
think before you codeTimofei Gerasimov6.4
Programming TipsJatin Gandhi6.3
Pointer arithmetic hackVivek Ahlawat6.3
Unexpected struct behavior in Borlands Turbo C++ 3Raza Sayed6.3
Effective use of ==Er.Nathan6.3
Make libraries for yourselfValseedian6.2
use of ! operatormrinal jha6.2
Initialise all variablesJia.Lu6.2
getchar() returns an intRob6.2
compiler tipJulian Sutherland6.2
Fix all compiler warningsrickey6.1
backups using CVS save you lot of spaceLeif6.1
Free The Memory That You UseUdhaya Kumar.D6.1
Use makefilecjediknight6.1
Use Good Variable And Function Namesprog-bman6.1
Error handling for newUpesh Jindal6.1
Do NOT always check for NULL! (C++)Kevin Lam6.1
gets() is bad.Sean6.1
Fastest raise to power.Ezzetabi6.0
Run code in Different compilersNaren Varma6.0
Prefer pre-increment and pre-decrementKarl6.0
Pointer arithmetic trickinessvishesh jain6.0
Test pieces of your code earlyHardi Pertel6.0
Understanding the win32 data typesMuhammad Shahid6.0
Reuse Old CodeTimofei Gerasimov6.0
Rounding a floating point number to a near-fractionSteven6.0
Dynamic memory allocation of 2d arraysnandam6.0
Make backupsVox6.0
Tips for writing programs for beginnerspradeep6.0
Modifying const variablesWiro Sableng6.0
String to integerMayur Avhad6.0
Use const variables as function parameters when pobeyonddc5.9
Use STL containers instead of C arraysSang-drax5.9
Executing system commandsSean5.9
Turn on all compiler warningsMaragato5.8
Always check for NULL (in C)Webmaster5.8
Use multiple filesThantos5.8
Use <constant> == <value>Webmaster5.8
Goto vs. Higher-level control structuresSean5.7
Commenting out code with the preprocessorWebmaster5.7
Use templates to prevent memory leakageKunal5.7
Don't use fflush(stdin)Shakti5.7
Use the Appropriate VariablesMahesh Kumar.S5.6
beware of loop invarinatsIain5.6
Member Functions are inline by default (C++)Ash5.6
Avoid memory wastageArthi5.6
Get a copy of the standardThantos5.6
take advantage of array indiciesDave5.6
pre & post increment & decrement operatorsjay5.6
Turn off optimization when debuggingAshok Kumar5.5
Doing calculationsLinuxguru5.5
Make pointer and reference arguments constAkshay5.5
Comment!VOX5.5
Give Proper Names to Your VariablesMaragato5.5
char *pa; and char a[];avdtech5.5
Indent your ProgramPrashant Sahay5.5
match the out side world ideas to logical designinmady5.4
Put braces around if statement code, part 2PING5.3
Compiling 32-bit code on a 64-bit machinevinay Kumar5.0
Cute but dangerous code, finding the larger integer without using comparisonsPrakash Samy5.0
Don't modify a variable more than once in a single statementGanga R Jaiswal5.0
Operator Associativity and HierarchyAvinash5.0
What is pointer arithmetic?Umer khan4.6
Decompose before you codeAbhinandan Pandey4.5
finding size of variable without using sizeof()Rajesh punia4.0
swap with out using temporaryraghava4.0
Arguments for MainSajan3.7
Automatic Array initialisationkedar3.7
creating a messagebox on WindowsAmarjeet Kawathe3.5
Check the return value of scanf( )citizen3.2
Be careful of Magic behaviour due to compilersmanik3.0
increment and decrement on pointerRAJKUMAR3.0
Checking if two arrays are equalUnnikrishnan T A0.7
Assigning a char array to another char arrayBrian Plummer0.5
Increment and decrement counters with rolloverLee Walker0.0
Using _strtime and _strdate to get the timeAli Jafar0.0
One instruction per lineLudovic Flender0.0
Use preincrement with iteratorsDirk Tjantele0.0
Use virtual functions instead of type checkingSajan0.0
Why you can't dereference a void* pointerashish mathur0.0
Don't increment the same variable multiple times in one statementsidra0.0
Never return a non-const pointer to a data member!hussain hani0.0
Display Date and Time in C++Govind0.0
Long variable namesCarl0.0
take care while using new and deleterajender0.0
Operator precedence shortcutsai shanker0.0