Assignment 2 CH 2 C Programming Basics
Assignment 2 CH 2 C Programming Basics
Assignment 2
(Chapter – 2 : C-Programming Basics)
8. What would be the value of variable X after execution of the following statements?
int x, y = 10;
char z = ‘a’;
x = y + z;
9. Identify syntax errors in the following program. After corrections, what output would you
expect upon execution of the program?
#define PI 3.14159
main()
{
int R, C; /* R – Radious of a circle
float perimeter; /* C – Circumference of circle */
float area; /* Area of Circle */
C = PI
R = 5;
Perimeter = 2.0 * C * R;
Area = C*R*R
printf(“%f”, “%d”, &perimeter, &area);
}
10. Explain, how the following declarations shall be interpreted by the compiler?
a. const int class_size = 50;
b. volatile int class_size = 50;
c. volatile const int class_size = 50;