Presentation is loading. Please wait.

Presentation is loading. Please wait.

C Programming Lecture-3 Keywords, Datatypes, Constants & Variables

Similar presentations


Presentation on theme: "C Programming Lecture-3 Keywords, Datatypes, Constants & Variables"— Presentation transcript:

1 C Programming Lecture-3 Keywords, Datatypes, Constants & Variables
$p!derLabWeb C Programming Lecture-3 Keywords, Datatypes, Constants & Variables

2 Keywords These are the reserved words which cannot be used as the identifiers name or constants or variable. They have the special meaning in the C language. These are some of the keywords in C:

3 Datatypes Datatype tells about the type of data it can store in the variable and how much space is given to the particular type. Different types of datatypes:- Integer type (char, int, short, long etc.) Floating-point type (float, double and long double)

4 Variables It is the name given to the storage area in the memory and can be manipulated according to the program. These are declared using datatypes which tells about the type of data to stored in it and how much storage is given to it.

5 Constants These are the fixed values which cannot be changed during the execution of program. These are also known as literals. These are some literals:- Integer literals /* decimal */ /* octal */ 0x3e /* hexadecimal */ 36u /* unsigned int */ 75l /* long */ 56ul /* unsigned long */

6 Floating-point literals
/* Fractional form*/ 1569E /* Exponantial form */ Character literals ‘d’ /* single character only used in between single quotes */ String literals “spiderlabweb” /* used in between double quotes */

7 Rules for writing a variable name
It should not be a keyword. it can be composed of alphabets, numbers and underscore (_). It should not start with a number. It should be started with a alphabet or underscore (_) NOTE: lower and uppercase letters are treated differently.

8 Initialization and Declaration of variables
Syntex for intialization of variales: type variable_name; eg. int a; /* initializing a of int type */ float b; ; /* initializing b of float type */ char c; ; /* initializing c of char type */

9 Syntex of declaration of variable: type variable_name = constants; Eg
Syntex of declaration of variable: type variable_name = constants; Eg. int a = 10; /* assigning 10 to a of int type */ double b = ; /* assigning to b of double type */ char c =‘k’; /* assigning k to c of char type */

10 Thank you!


Download ppt "C Programming Lecture-3 Keywords, Datatypes, Constants & Variables"

Similar presentations


Ads by Google