BCA 103 Unit2 PPT
BCA 103 Unit2 PPT
Introduction to C-Programming
Constants
• Constants are those quantities whose value may not change during the
execution of a C program.
• C Supports Integer, Character, String and Floating–point constants.
char ch;
ch= 'A';
printf ("%c", ch);
Integer
• Integer variables are used in the C–Language to store numbers without
decimal points.
• To declare a variable of type integer, we will use keyword "int".
• Any variable declared with type "int" will occupy 2 Bytes (=16 Bits) of space
in the memory.
int number;
number=45;
printf ("%d", number);
Float
• To access and to store any real value, float data type is used. C's float data
type occupies 4 bytes in the memory.
1. Variable declared with float data type will occupy ________space in memory.
[A] 1 Bytes [B] 2 Bytes [C] 4 Bits [D] 4 Bytes
1. Variable declared with float data type will occupy ________space in memory.
[A] 1 Bytes [B] 2 Bytes [C] 4 Bits [D] 4 Bytes
• For example, Mam and mam are not same. The underscore character can
also be included and is treated as a letter.
• Thus, x and y are integer variables, w and l are float variables, a is an integer
array whose size is 10 and k is a character array with a size of 5
Assigning Values to Variables
• If the values of the variables are known, then you can present the
declarations as given below :
int x=5;
char name= 'A';
float z= 5.36;