Thursday, 1 June 2017

C Syntax Rules ~ mkniit

C Language Syntax Rules

C language syntax specify rules for sequence of characters to be written in C language. The rule specify how character sequence will be grouped together to form tokens. A smallest individual unit in c program is known as C Tokens. Tokens are either keyword, identifier, constant, variable or any symbol which has some meaning in C language. A C program can also be called as collection of various tokens.
Example of C tokens,
intcurly braces { }commentssemicolon ;

Comments

Comments are simple text in your C program that increases readability of programs. Compiler ignore anything written as comment in your program.
Example of comments :
Single line Comment
//This is a comment

Single line Comment
/*This is a comment*/

Multi line Comment
/*This is a long 
and valid comment*/

Wrong Syntax
//this is not
  a valid comment

Some basic syntax rule for C program

  • C is a case sensitive language so all C instructions must be written in lower case letter.
  • All C statement must be end with a semicolon.
  • Whitespace is used in C to describe blanks and tabs.
  • Whitespace is required between keywords and identifiers
C language syntax rules

No comments:

Post a Comment