Pages

Thursday, 18 February 2016

Programming Style of C

As Compare to some other programming C give an very important relaxation of writing program without caring where on the line we begin typing and this quality make c, a free form programming language.


Although a bad practice of programmer on this style may be license for bad programming. But we should try to use this feature or relation to our advantage in developing readable and easy to maintain programs.


First of all we must clear that we must programming in habit of writing our C program in small letters. All statements including variable, constant, keyword and function must written in small letters.


Although Capital letter must use only where we use symbolic constants.


Braces is very important unit of C programming, group statements together and set the beginning and the end of functions.

every Statement in C programming contain semicolon to tell compiler about termination of one line/sentence/instruction of program. Therefore beginner must remember this that every statement {one sentence of Programming} contain semicolon in last as in English every sentence contain full stop in last of sentence.

AS above described C is free form language, we can group statements together on online

Example :
    a = b;
    x = Y + 1;
    Z = a + x;


can be written on one line as
   
    a = b; x = y + 1; z = a + x;

Now see an Example of Program

main()
{
printf("Hello University");
}


may be written in one line like

main(){printf("Hello University");}


But this style not accepted by anyone because this style make the program difficult to readable and understand. it should not be eligible for re-engineering. each statement must be written in separate line that increase the readability but also help to understand the program logic. therefore in this tutorial we written a program's statement in separate line.

No comments:
Write comments

Popular Posts

Recommended Posts ×