Programming practices in C. This is a small article on good programming practices in C language. To be a good programmer, you'll have to follow these practices which contributes to increase the readablity and portability of your code. Writing portable and readable code are two of the most important practices the employers in software industry expects a programmer to posess. They do not need individual players but someone who works in a team. When working in a team, it is essential that the code we write could be understood by everyone so that it can be further updated and modified by anobody in the team easily as requirement of the software changes. 1)Writing Portabe code. 2)Good practices in C programming a)Avoid using void main() b)Use descriptive variable names. 1)Writing Portable code: The software industry requires people who can write portable code rather than the people who can write platform dependant code. This is mainly because they may have to change the platform of development at any point of time. When they change the platform, they do not want to rewrite the code allover again for another platform. By having portable code, they can use the same code in another platform with just minor or no changes at all. The portable code can be written by following ANSI standard for C. It makes the code completely portable from one platform to another. The C99 Standard. This is the latest standard that is incorporated to ANSI C. ----More about C99 standard to be addedd here------------------ 2)Good practices in C programming: a)Avoid using void main() We have this practice of using void main() by many students while writing the main function just to avoid warning message by the compiler to return value from main. This is a wrong practice because the value returned by the main is required by the host (operating system) to know the termination status of the program. The ANSI standard conforming compilers will fail to compile successfuly if we use void main(). There are two termination status specified by the standard which are EXIT_SUCCESS and EXIT_FAILURE. The return value 0 or EXIT_SUCCESS gives the implementation-defined form of the status successful termination. The return value 1 or EXIT_FAILURE gives the implementation defined form of the status unsuccessful termination. Otherwise the status returned is implementation-defined. So a typical C program should have a main function written as follows: int main(void) { ........ ........ return 0; } b)Use descriptive variable names. Writing programs with short variable names can be easy only as long your program is short. When the program grows larger, it becomes really difficult to make out which variable is used for what purpose. The real-life softwares development requires coding thousands of lines for a single program. So the variable names should be descriptive enough to be able to recall what it is used for as soon as you see the program block. Here is an example of program for calculating Simple Interest: int main(void) { int p, t, r, si; printf("\nEnter principle, time, and rate of interest"); scanf("%d%d%d",&p,&t,&r); si=p*t*r/100; printf("\nThe simple interest is:%d\n",si); return 0; } In the above example, it would be much more readable if we use 'principle', 'time' and 'simple_interest' as variable names rather than p, t, r and si. ----------To be continued with more goood programming practices------------------