Join us Now |  Forgot Password? | Forgot UserName?


Learn step by step

C-basic Syntax

As we have seen about basic structure of C program , it will be easy for us to understand other basic building blocks of this language.

Tokens in C:

There are various tokens in C language which can be either a keyword, literal , identifier, symbol and a constant.

Below is the following C statement that consists of five tokens which are as :

printf("Hello, TutOn! \n");

The individual tokens are:

printf ( "Hello, TutOn! \n" );

Semicolon is called a statement terminator in C language. This means that each statement in C language must end with a semi colon. This indicates the end of one logical entity.

Below are the two statements as an example for a better understanding:

printf("Hello, TutOn! \n");
return 0;
Comments :

In C language comments are very useful and they are like helping text. These are ignored by C compiler.These start with /* and ends with */ as shown below:

/* my first program in C */

  • In C language any user-defined item, variable, function are recognized by identifiers.
  • An identifier consists of letter A to Z, a to z, underscore_ followed by 0 or more letters, underscores and digits 0 to 9.
  • Within identifiers punctuation characters such as @, $ and % are not considered.
  • The most important thing to remember for C language is that it is a case-sensitive.
  • For example: Manpower and manpower are two different identifiers in C language.
  • List of some acceptable identifiers are given below:

mohd, zara , abc , move_name, a_123, myname50 , _temp , j , a23b9 , retVal.

Below is the list of various reserved words used in C language. These reserved words can't be used as a constant or variable or any other identifier names.

auto else long switch
break enum register typedef
case extern return union
char float short unsigned
const for signed void
continue goto sizeof volatile
default if static while
do int struct _Packed
Wide space in C:

i. The term called blank line in C is a line that contains only wide space, possibly with a comment.

ii. In C wide space is the term used to describe blank spaces, tabs, newline characters and comments.

iii. Wide space is used to separate one part of statement from another and enables the compiler to identify where one element in a statement, such as int, ends the next line begins.

iv. Therefore, in the below statement:

int age;

It is easy for compiler to distinguish between int and age if there is at least one white space character. On the other hand in the following statement:

fruit = apples + oranges; // get the total fruit

There is no wide space needed between fruit and =, or between = and apples, but for easy reading one is free to include.

Related Videos