Syntax of C

The c programming syntax is very esay and simple to understanding the c programming language,the following basic example of c syntax.

Basic Syntax of C


main()
{
     Printf(“Hello”);
}
							

Basic Rules of C Syntax

 C is case-sensitive. The declaration int x is different from int X. All instructions must be written in lower case letters.

 All statements must end with the terminating character – semicolon ‘;’

 White space denotes blanks and tabs.

 White space should be used in between keywords and identifiers.

Character Set

The characters that compose the C language syntax are grouped as follows:

 Letters – This includes all alphabets (a-z, A-Z).

 Digits – Numbers from 0 to 9.

 Special Characters – The special characters in C include: semicolon (;), colon (:), period (.), underscore (_), ampersand (&) and more.

 White Space

C Identifiers

 In C programming, identifiers are names that are used to refer to variables, functions, constants and user-defined data. There exists a set of rules that should be followed when creating identifiers:

 Identifiers should only have alphanumeric characters (a-z, A-Z, 0-9). The only non-alphanumeric character that can be used is the underscore (_).

 The first character can only be an alphabet or an underscore (_). Numbers are not allowed to start a variable name (int 8var).

 Identifiers are sensitive to case. Therefore int var is different from int Var or int VAR;

 No special characters aside from the underscore are allowed to be used in an identifier.

Share Share on Facebook Share on Twitter Share on LinkedIn Pin on Pinterest Share on Stumbleupon Share on Tumblr Share on Reddit Share on Diggit

You may also like this!