Uploaded by Mohammed Ibrahim

PPS

advertisement
PPS
ESC APE SEQUENCE
SPECIAL CHARACTERS
DATA TYPES - BASIC
• Data type defines the type of data stored in the memory.
• C supports three types of data types
1.
Primary e.g. int, float,..
2.
Derived e.g. array
3.
User defined e.g. structures
• Primary data types
• 1. int: As the name suggests, an int variable is used to store an integer.
• 2. float: It is used to store decimal numbers (numbers with floating point value) with single precision.
• 3. double:: It is used to store decimal numbers (numbers with floating point value) with double precision
• 4. char: The most basic data type in C. It stores a single character and requires a single byte of memory in almost all
compilers.
• The definition of the variable will assign memory location & also the type of data that will be stored in the
location.
• Modifiers 1. short 2. long 3. signed 4. unsigned
DATA TYPES
VARIABLES
• It is a name given to a storage area that the programs can manipulate.
• Each variable has a data type that determines the size & range of values that can be
stored within the memory.
• The name of the variable can be composed of letters, digits, and the underscore
character.
• Upper and lower case characters are different.
• E.g. int i, j, k; double d; char ch; float sal;
• Variables can be initialized. E.g. int d =3, f = 5; float pi = 3.14;
• First character must be a letter and maximum length is 31.
• Keywords cannot be used as variable names.
char s = ‘d’;
OPERATORS
• C supports a rich set of operators.
• An operator is a symbol that tells the computer to perform certain mathematical or logical manipulations.
• Operators are used to in programs to manipulate data and variables.
• C operators are classified into number of categories.They include1.Arithmetic operators
2. Relational operators
3. Logical operators
4.Assignment operators
5. Increment and decrement operators(unary operator)
6. Conditional operator
7. Bitwise operator
8. Special operators
Download