Posted By:
10 Jun, 2013 11:55 pm PDT

Basic Syntax in C

It�s the basic building blocks of a C program
Header files
Tokens
Semicolons
Comments
Keywords
Whitespaces


Please watch the video for details.

Attachment:None


Please see the video for the details.....
Was it useful?  



A C program has the following components (usually found in this order) :

  1. Preprocessor Commands
  2. Type Definitions
  3. Function Prototypes
  4. Variables
  5. Functions

 

Every C program must have a main function.

 

Tokens in C

A C prog ram consists of various tokens and a token is either a keyword, an identifier, a constant, a string literal, or a symbol. For example, the following C statement consists of five tokens:

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

 

The individual tokens are:

 

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

 

Semicolon (;)

In C program, the semicolon is a statement terminator. That is, each individual statement must be ended with a semicolon. It indicates the end of one log ical entity.
For example, following are two different statements:

 

printf("Hello, World! \n");
return 0;

 

Comments

Comments are like helping text in your C program and they are ignored by the compiler. They start with /* and terminates with the characters */ as shown below:

/* my first program in C */


You cannot have comments within comments and they do not occur within a string or character literals.

 

Whitespace in C

A line containing only whitespace, possibly with a comment, is known as a blank line, and a C compiler totally ignores it. Whitespace is the term used in C to describe blanks, tabs, newline characters and comments. Whitespace separates one part of a statement from another and enables the compiler to identify where one element in a statetement ends and the next element begins.


Was it useful?  




Please login to reply to this problem.