PROGRAMMING LANGUAGE C

PROGRAMMING LANGUAGE ‘C’ 1. main() { int a=4,b=2; a=b2; printf("%d", a); } a) 32 2. b) 2 c) 4 d) none main() { int *ptr=(int*)malloc(sizeof(int)...
Author: Sharleen Sharp
5 downloads 1 Views 122KB Size
PROGRAMMING LANGUAGE ‘C’ 1.

main() { int a=4,b=2; a=b2; printf("%d", a); } a) 32

2.

b) 2

c) 4

d) none

main() { int *ptr=(int*)malloc(sizeof(int)); *ptr=4; printf("%d",(*ptr)+++*ptr++); } a) 7

3.

4.

5.

b) 9

c) Runtime error

#define MAX 3 main() { printf("MAX = %d \n",MAX ); #undef MAX #ifdef MAX printf("Vector Institute”); #endif } a) MAX=3, Vector Institute b) MAX=3 d) Compile time error int array[]={1,2,3,4,5,6,7,8}; #define SIZE (sizeof(array)/sizeof(int)) main() { if(-1