You are on page 1of 8

| 

 




 

  
!  

 


˜ Why would you want to be a good


developer? Ʀ well it is going to be the
bread and butter in your careers.
˜ If you make some good coding habits
now, they will pay dividends in the
long run
˜ The road to being a good developer
starts with following good coding
standards!

 

˜ These are general rules of writing


code Ʀ kindof similar to what we have
in English, like Ơthou shalt always start
a new paragraph with an
indentation/tabơ

˜ The rules of coding a much cooler


than the English language Ʀ behold Ʀ
  

int nCount
nCount;; // and not Ɲint a;ƞ
char szFilename[MAX_PATH];
szFilename[MAX_PATH];
// and not Ɲchar arr[256];ƞ
arr[256];ƞ
bool fValid
fValid;; // and not ƝƝbool
bool c;ƞ

˜ Ɲnƞ in nCount means the variable is an int


˜ Ɲsz
szƞƞ in szFilename means the array will contain a
string terminated by 0
˜ Ɲfƞ in fValid means itƞs a flag Ʀ i.e. true/false
î 
  

!
 



void main() void main()
{ {
int a=1; int a=1, b=2;
int b=2;
if(a!=b) if( a != b )
printf("\nHello"); {
printf(" World"); printf("\nHello");
for( int i=0;i<4;i++) printf(" World");
for( int j=0;j<4;j++) }
{
if(i==j) for( int i=0; i<4; i++)
printf("\n%d. Hey There", i ); for( int j=0; j<4; j++)
else {
printf("\n%d. Ho Ho Ho", i );} if( i == j )
printf("\nBye Bye" ); printf("\n%d. Hey There", i );
} else
printf("\n%d. Ho Ho Ho", i );
}

printf("\nBye Bye" );
}
*  
 



!
 



Ainclude <stdio.h> Ainclude <stdio.h>

void main() Adefine MAX_NAME_LENGTH 50


{ Adefine MAX_NUM_OF_STUDENTS 100
char szNames[100][50];
void main()
{
for( int i=0; i<100; i++ )
char szName[MAX_NUM_OF_STUDENTS][MAX_NAME_LENGTH];
scanf("%s", &szNames[i] );
for( int i=0; i< MAX_NUM_OF_STUDENTS; i++ )
for( int j=0; j<100; j++ ) scanf("%c", &szNames[i] );
printf(Ơ%s", szNames[j] );
} for( int j=0; j< MAX_NUM_OF_STUDENTS; j++ )
printf("%c", szNames[j] );
}
·  ! "  !
 

˜ Use breakpoints (F-
(F-9) and always run
in Debug mode (F-
(F-5)

˜ Step inside functions with F-


F-11 key
when debugging to checkout if
everything is good

˜ Always test your code with different


input data before signing off on code
 #  $

Best of luck to you all Ʀ


and wish you a good
career ahead!