Professional Documents
Culture Documents
Unit1 C Programming 29 09 2022
Unit1 C Programming 29 09 2022
ANSI C
Syntax and Constructs of C
• Syntax is the grammar of any programming language.
• Every statement in C must end with semicolon(;)
• Variable declarations:
• Syntax : datatype variablename;
• examples: int sum; float area;
• Constructs of C
• Selection constructs: if, if ..else, if.. else if.. else and switch
• Looping constructs: while, do.. while and for
Syntax and Constructs of C
Variables
• Variable is an entity that has a value and is known to the program by
its name.
• Its can be changed during the execution of program
• It can only have one value at anytime during program execution
• Variables are stored in memory.
• in storage locations with unique address
Variable Naming
• Variable declaration:
• Syntax: datatype variablename;
• e.g. float radius; float area;
• All variable declarations should be after main() function call or before
its first use.
Variable Naming