Learn C : Syntax introduction, examples and Interview questions.
C Syntax:
Syntax are the predefined set of rules of any programming language, that defines the combinations of symbols that are considered to be a correctly structured document or fragment in that language.
Any program is nothing but a set of instructions. These programs are following certain rules called as Syntax Rules.
C character set:
Character set is a set of valid characters that a language can recognize. A character represents any letter, digit, or any other sign.
The C has following character set:
Letters: A-Z, a-z
Digits: 0-9
Special Symbols:
White space characters:
\b blank space
\t horizontal tab
\v vertical tab
\r carriage return
\f form feed
\n new line
\\ backslash
\' single quote
\" double quote
\? question mark
\0 null
\a alarm bell
Tokens:
The smallest individual unit in a program is known as a Token or a Lexical unit.
C has following tokens :
➣Keywords
➣Identifiers
➣Literals
➣Punctuators
➣Operators
Keywords:
Keyword is a word having special meaning reserved by programming language. These are reserved for special purpose and must not be used as normal identifier names.
C language supports 32 keywords that are listed below:
Identifiers:
Identifies are fundamental building blocks of a program and are used for the names given to different parts of the program viz. variables, objects, classes, functions, arrays, etc.
Rules for forming identifiers are:
➣The first letter must be a letter, underscore must be count as letter.
➣All characters are significant.
➣Upper case and lower case letters are different.
Note:
C is a case-sensitive language as it treats upper case and lower case characters differently.
Previous Next
For any query related to the content mail to devkumar082001@gmail.com
_ underscore | - minus sign |
> greater than | ^ caret |
# number sign | = equal to |
& ampersand | $ dollar sign |
/ slash | { left paranthesis |
* asterisk | \ back slash |
} right paranthesis | ' apostophe |
: colon | [ left bracket |
" quotation mark | ; semicolon |
] right bracket | ! exclamation mark |
, comma | . dot operator |
@ at symbol | ~ tilde |
% percent sign | | vertical bar |
{ left flower brace | ? question mark |
} right flower brace |
White space characters:
\b blank space
\t horizontal tab
\v vertical tab
\r carriage return
\f form feed
\n new line
\\ backslash
\' single quote
\" double quote
\? question mark
\0 null
\a alarm bell
Tokens:
The smallest individual unit in a program is known as a Token or a Lexical unit.
C has following tokens :
➣Keywords
➣Identifiers
➣Literals
➣Punctuators
➣Operators
Keywords:
Keyword is a word having special meaning reserved by programming language. These are reserved for special purpose and must not be used as normal identifier names.
C language supports 32 keywords that are listed below:
auto | double | int | struct |
const | float | short | unsigned |
break | else | long | switch |
continue | for | signed | void |
case | enum | typedef | register |
default | goto | sizeof | volatile |
char | extern | return | union |
do | if | static | while |
Identifiers:
Identifies are fundamental building blocks of a program and are used for the names given to different parts of the program viz. variables, objects, classes, functions, arrays, etc.
Rules for forming identifiers are:
➣The first letter must be a letter, underscore must be count as letter.
➣All characters are significant.
➣Upper case and lower case letters are different.
Note:
C is a case-sensitive language as it treats upper case and lower case characters differently.
Previous Next
For any query related to the content mail to devkumar082001@gmail.com
No comments: