The basic structure of C programming is easy and it will be
help full to understand other building blocks of the C programming language.
Tokens:
A token in c programming is either a keyword, an identifier,
a constant, a string literal, or a symbol.
For example,
the following statements of a c program consist five tokens:
printf("Hey, World! \n");
The five tokens are:
1.printf
2.(
3."Hey, World! \n"
4.)
5.;
Semicolons(;)
The semicolon is a statement terminator in a c program.
Each statement in c must be ended with a semicolon.
For example,the two different statements:
1.printf("Hey, World! \n");
2.return 0;
each statement is ended with a semicolon.
Comments:
Comments helps to easily understand your C program and they
are not compile by the compiler.
They start with /* and terminates with the characters */ as
shown below:
/* c program for print hello */
You cannot have comments within comments.
Identifiers:
A identifier is a name used to identify a variable,
function, or any other user-defined item.
An identifier would be start with a letter A to Z or a to z
or an underscore _ followed by zero or more letters, underscores, and digits (0
to 9).
the followimg symbols cannot be used within identifiers .@,
$, and % .
Here are some examples of acceptable identifiers:
mohd zara abc
move_name a_123
myname50 _temp j
a23b9 retVal
Keywords:
The following list shows the reserved words in C. These
reserved words may not be used as 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
double
|
|||
C - Overview | |||
C - Basic Syntax | |||
C - Data Types | |||
C - Variables | |||
C - Constants | |||
C - Storage Classes | |||
C - Operators | |||
C - Decision Making | |||
C - Loops | |||
C - Functions | |||
C - Scope Rules | |||
C - Arrays | |||
C - Pointers | |||
C - Strings | |||
C - Structures | |||
C - Unions | |||
C - Bit Fields | |||
C - Typedef | |||
C - Input & Output | |||
C - File I/O | |||
C - Preprocessors | |||
C - Header Files | |||
C - Type Casting | |||
C - Error Handling | |||
C - Recursion | |||
C - Variable Arguments | |||
C - Memory Management | |||
C - Command Line Arguments |
Friday, 22 November 2013
Home »
C language
» c Basic Syntax
0 comments:
Post a Comment