ITEC113Algorithms and Programming Techniques. C programming: Variables, Expressions Part I. Objectives. To understand what variables are initialization/garbage values naming conventions To learn about the frequently used data types To understand the components of an assignment Statements
Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.
ITEC113Algorithms and Programming Techniques
C programming: Variables, Expressions Part I
(e.g. if, else, int, float, case, for, …).
The second and the other characters of the name can be any letter, any number, or an underscore “_”.
Some valid names:
my_name, m113_1, salary, bluemoon, _at
Some invalid names:
my name, my-name , 1stmonth , salary! , guns&roses ,
These are NOTrules but you can increase the quality of your program by using them!
Example : intk ;
3.14159 534.3223440.3333333 0.1234567
Character : ( char )
Example: ‘A’ , ‘7’,
A is represented by decimal 65 or
8-bit binary 0 1 0 0 0 0 0 1
Categories of characters :
cnt= 1; sum = 0;
sum = sum + 1; avg = sum / cnt;
stores values 1 and 0 to cnt and sum.
stores character ‘Y’ to ch
stores computational results to sum and avg
In the Assignment Statement:
M = a * 5 + b % 4 ;
For real or integer numbers
For integer numbers only
-ve and +ve signs
Mult. Div., and mod.
Add and subtract