C Programming Language Syllabus
Overview Of C
Basic Structure of C Programming
Keywords in C
Identifiers in C
Format Specifiers
Format Specifiers Examples etc
Data Types in C Language
Introduction to Data Types in C
int Data Type in C
float Data Type in C
double Data Type in C
char Data Type in C etc
Variable in C Language
Variable Introduction in C
Variable Declaration and Initialization
Variable types and Scope in C
Local Variable in C
Static Variable in C
Global variables in C
Storage Class in C etc
Constant in C Language
Constants in C ,etc
Operators and Enums in C Language
Introduction to Operator
Arithmetic Operators in C
Relational Operators in C
Bit-wise Operators in C
Logical Operators in C
Assignment Operators in C
Conditional Operator in C
sizeof() Operator in C
Operator Precedence. etc
Decision Making of C Language
Decision Making in C Introduction
if Statement
if-else Statement
Nested if Statement
if else if Ladder
switch case. etc
Loop control in C Language
Loop Introduction in C
while loop in C
do while Loop In C
for Loop in C ,etc
Control Flow in C Programming
break Statement in C
continue Statement in C
go to Statement in C .etc
Array in C Language
Single Dimensional Array
Multi-Dimensional Array in C .etc
String & String functions in C
All String Functions
strcat() function
strncat() function
strcpy() function
strncpy() function
strlen() function
strcmp() function.etc
Function in C Language
Function in C
Function Calling in C
return type in Function
Call by Value in C
User Define Function
Predefined Functions. etc
Recursion in c
Introduction to Recursion
Direct and Indirect Recursion, etc
Pointer in C Language
Pointer in C
types of pointer
NULL pointer
Pointer and Array
Strings as pointers
Pointer to Function.etc
Structure in C Language
Structure in C
Nested Structure in C
Array of Structures in C
Pointer to Structure
Structure to Function in C
typedef in C, etc
Union in C Language Dynamic Memory Allocation
Union in C
CPrecedenceTable
Description Operator Associativity
Function expression () Left to right
Array expression [] Left to Right
Structure operator -> Left to Right
Structure operator . Left to Right
Unary minus - Right to Left
Increments Decrement ++ -- Right to Left
One’s complement Right to Left
Negation ! Right to Left
Address of & Right to Left
Value of address * Right to left
Type cast (type) Right to Left
Size in byte: size of Right to left
Multiplication * Left to right
Division / Left to Right
Modulus % Left to Right
Addition + Left to Right
Subtractions - Left to Right
Left shift << Left to Right
Right shift >> Left to Right
Less than < Left to right
Less than or equal to <= Left to Right
Greater than > Left to right
Greater than or equal to >= Left to Right
Equal to == Left to right
Not equal to != Left to Right
Description Operator Assciativity
Bitwise AND & Left to Right
Bitwise exclusive OR Left to right
Bitwise inclusive OR | Left to Right
Logical AND && Left to Right
Logical OR || Left to Right
Conditional ?: Right to Left
= <<= >>= Right to Left
*= /= %= Right to Left
Assignment += -= &= Right to Left
= \= Right to Left
<<= >>= Right to left
Comma , Right to Left
C Programming
Q1. What will be the output of following C program?
#include <stdio.h>
int main()
{
int i = 97, *p = &i;
foo(&p);
printf("%d ", *p);
return 0;
}
void foo(int **p)
{
int j = 2;
*p = &j;
printf("%d ", **p);
}
(a) 2 0 (b)0 2
(c) 2 2 (d)Compiler dependent
Q2. What will be the output of following C program?
#include<stdio.h>
void fun(int *p)
{
int z = 100;
p = &z;
}
int main()
{
int r = 201;
int *p = &r;
fun(&p);
printf("%d", ++*p++);
return 0;
}
(a) Compilation Error (b) 200
(c) 202 (d) 101
Q3. What will be the output of following C program?
Add a statement in the function fun() such that address of a get stored in X.
main()
{
int *X;
void fun(int**)
C Programming GATE-2020 Page 1
fun(&X);
}
void fun(int**Y)
{
int a = 20;
/* Add Statement */
}
(a)X=&a (b) *Y=&a (c) *x=&a (d) Y=&a
Q4. What will be the output of following C program?
#include<stdio.h>
void function(char**);
int main()
{
char *arr[] = { "ADA", "TOC", "CN", "DBMS", "DISCRETE", "ALGEBRA" };
function(arr);
return 0;
}
void function(char **ptr)
{
char *ptr1;
ptr1 = (ptr += sizeof(int))[-3];
printf("%s\n", ptr1);
}
(a)ADA (b)CN (c) TOC (d) ALGEBRA
Q5. What will be the output of following program?
#include <stdio.h>
int main()
{
int arr[]={10,11,12,13,14};
int *ptr,loop;
//initialize ptr
ptr = arr;
//printing the elements
for(loop=0; loop<5; loop++)
printf("arr[%d]: %d\n",loop,*(ptr+loop));
return 0;
}
a) b) c) d)
arr[0]: 10 arr[0]: 11 arr[0]: 11 arr[0]: 10
arr[1]: 11 arr[1]: 12 arr[1]: 12 arr[1]: 12
arr[2]: 12 arr[2]: 13 arr[2]: 13 arr[2]: 13
arr[3]: 13 arr[3]: 14 arr[3]: 14 arr[3]: 14
arr[4]: 14 arr[4]: 10 arr[4]: 15 arr[4]: 11
C Programming GATE-2020 Page 2
Q6. What will be the output of following program?
#include <stdio.h>
int main()
{
char a[] = { 'A', 'B', 'C', 'D' };
char* ppp = &a[0];
*ppp++;
printf("%d ", *++ppp + --*ppp);
}
(a)132 (b)131 (c) 130 (d)134
Q7. What will be the output of following program?
int main()
{
int num[5];
int* p;
p = num;
*p = 10;
p++;
*p = 20;
p = &num[2];
*p = 30;
p = num + 3;
*p = 40;
p = num;
*(p + 4) = 50;
for (int i = 0; i < 5; i++)
{
printf("%d\t",num[i]);
}
return 0;
}
(a) Compilation Error (b) 10 20 30 40 50
(c) 10 20 30 40 50 60 (d) 50 40 30 20 10
Q8. What will be the output of following program?
int main()
{
char* str = "GATEATZEAL";
printf("%c\n", *&*++str);
return 0;
}
(a) Compilation Error (b)G
(c)A (d)T
C Programming GATE-2020 Page 3
Q9. What will be the output of following program?
#include<stdio.h>
int main()
{
int a[5]={10,20,30,40,50};
int *ptr =a;
printf("%u\n",*++ptr +3 );
printf("%u\n",*(ptr-- +2) +5 );
printf("%u\n",*(ptr +3)- 10 );
printf("%o\n",0123 );
return 0;
}
a) Compilation b) 23 c) 10 d)13
Error 45 20 25
30 30 40
123 40 0123
Q10. What will be the output of following program?
#include <stdio.h>
int main()
{
char A = 10;
int *b;
int a[][3]={0,1,2};
char B='11';
b=a;
for (int i=0;i<=2;i++)
{
printf("%d\t",b[i]);
}
return 0;
}
(a) Compilation Error (b) 0 1 2
(c) 0 11 2 (d) 0 1 2 11
Q11. What will be the output of following program?
#include <stdio.h>
int main()
{
char A = ‘70’;
int *b;
char B='11';
int C = "A";
printf("%d %c ",C,B);
C Programming GATE-2020 Page 4
return 0;
}
(a) Compilation Error (b) 65 1
(c) A 11 (d)None Of above
Q12. What will be the output of following program?
int main()
{
char S1[]="hello";
char S2[]= {'h','e','l','l','o'};
int i=100;
int *p1,*p2;
p1=&i;
p2=(++p1);
--p1;
printf("%u",p2-p1);
int a[] ={0,1,2,3,4};
int *p[]={a,a+1,a+2,a+3,a+4};
int **ptr=p;
ptr++;
printf("%d,%d,%d", ptr-p,*ptr-a,**ptr);
printf("%d,%d,%d,%d",sizeof(S1),sizeof(S1[0]),sizeof(S2),sizeof(S2[0]));
return 0;
}
(a) Compilation Error (b)1,1,1,1,6,1,5,1
(c)1,1,1,1,6,1,1,5 (d)None Of these
Q13. What will be the output of following program?
#include<stdio.h>
#include<string.h>
void main()
{
struct
{
int num ;
float f;
char mess[50];
}m;
m.num=1;
m.f=3.14;
strcpy(m.mess,"Everything looks rosy");
printf("\n%d\t%f\t%s",m.num,m.f,m.mess);
};
C Programming GATE-2020 Page 5
(a) Compilation Error (b) 11,1,16,1,5,1
(c) 1 3.140000 Everything looks rosy (d)None Of above
Q14. What will be the output of following program?
#include<stdio.h>
void fun(int *a, int *b)
{
++b; a[2] = a[1] + 6;
}
int main()
{
char A[5] = {'0','1','7','3','4'};
fun(A, A[2]);
printf("%d", A[2]);
return 0;
}
(a) Compilation Error (b) 55 (c)7 (d)1
Q15. What will be the output of following program?
#include <stdio.h>
int main(void)
{
struct node
{
int data ;
struct node*link;
};
struct node *p,*q;
p=malloc(sizeof (struct node));
q=malloc(sizeof (struct node));
printf("\n%d\t%d",sizeof(p),sizeof(q));
return 0;
}
(a) 4 8 (b) 8 8 (c)8 4 (d)4 4
Q16. What will be the output of following program?
#include <stdio.h>
#define SIZE(arr) sizeof(arr) / sizeof(*arr);
void fun(int* arr, int n)
{
int i;
*arr += *(arr + n - 1) += 15;
}
void printArr(int* arr, int n)
{
C Programming GATE-2020 Page 6
int i;
for(i = 0; i < n; ++i)
printf("%d ", arr[i]);
}
int main()
{
int arr[] = {10, 20, 30,40};
int size = SIZE(arr);
fun(arr, size);
printArr(arr, size);
return 0;
}
(a) 65 20 30 55 (b) 10 20 30 40 (c)25 35 45 55 (d)65 20 30 40
Q17. What will be the output of following program?
#include <stdio.h>
int f(int x, int *py, int **ppz)
{
int y, z;
**ppz += 1;
z = **ppz;
*py += 3;
y = *py;
x += 3;
return x + y + z;
}
void main()
{
int c, *b, **a;
c = 5;
b = &c;
a = &b;
printf( "%d", f(c,b,a));
//getchar();
}
(a)20 (b)23 (c)24 (d)Compilation Error
Q18. What will be the output of following program?
#include <stdio.h>
int num_elts(int *a)
{
int *p;
p = a;
while(*p != -1)
C Programming GATE-2020 Page 7
{
p++;
}
return p-a;
}
int main()
{
int arr[] = {1, 2, 3, -1};
printf("%d", num_elts(arr));
return 0;
}
(a)2 (b)-3 (c)3 (d)1
Q19. What will be the output of following program?
#include <stdio.h>
int main(void)
{
int x[2 ][3]={1,2,3,4,5,6,7};
printf("%d",*(*(1+x)+1));
return 0;
}
(a)5 (b)6 (c)7 (d)8
Q20. For the following questions, use the declaration of variables shown below. You can
try building a simple program using the given specification in order to answer the
questions.
int i, j[5] = {4, 5, 6, 7, 8}, *ptr1 = &j[0], *ptr3;
float x[5] = {4.0, 5.0, 6.0, 7.0, 8.0}, *ptr2;
1. For each statement below, specify which are valid and which aren’t.
a. ptr1 = ptr1 + 3; _________
b. j = j + 1; _________
c. ptr1 = j + 1; _________
d. ptr2 = ptr1; _________
e. ptr1 = j[1]; _________
f. ptr1 = 2; _________
g. i = ptr1; _________
h. ptr3 = ptr1; _________
i. i = j[2]; _________
j. ptr2 = x; _________
k. ptr1 = ptr1[2]; _________
l. x = &ptr2[2]; _________
m. j = ptr1 + 3; _________
n. ptr1 = &j[1]; _________
C Programming GATE-2020 Page 8
Q21. Evaluate the address of each expression. The j[ ] array begins at A008 and the x[ ]
array begins at 9008.
a. &j[0] _________ b. j _________
c. j – 2 _________ d. j + 4 _________
e. &x[4] _________ f. x + 3 _________
g. x – 3 _________ h. &x[2] + 3 _________
Q22. What will be the output of following program ?
#include <stdio.h>
int main()
{
int x1 = 10;
int *x2, **x3, ***x4;
x2 = &x1;
x3 = &x2;
x4 = &x3;
printf("%d%d%d%d", (x1==10), (*x2==10),( *x3==10), (***x4==10) );
}
(a)1101 (b)10101010 (c)10100101 (d)110110
Q23. What will be the output of following program ?
#include <stdio.h>
void main()
{
int arr[3][3]={1,2,3,4,5,6,7,8,9};
int i=0, sum=0;
while(i<3)
{
sum += *(*(arr+i)+(i++));
}
printf("sum:%d", sum);
}
(a) sum:15 (b)sum:11 (c)sum:16 (d)sum:18
Q24. What will be the output of following program ?
#include<stdio.h>
void main()
{
int a[3][4]={1,2,3,4,5,6,7,8,9,10,11,12},*p[3],i,j;
for(i=0;i<3;i++)
{
p[i]=&a[i][0];
C Programming GATE-2020 Page 9
for(i=0;i<3;i++)
{
for(j=0;j<4;j++)
{
printf("%d ",*(*(p)+j));
}
}
}
}
(a) 1 2 3 4 1 2 3 4 1 2 3 4 (b) 1 2 3 4 5 6 7 8
(c) 1 2 3 4 5 6 7 8 9 10 11 12 (d) Invalid Memory Reference Error
Q25. What will be the output of following C program?
#include <stdio.h>
int main()
{
int x[] ={1,2,3,4,5};
int u;
int *ptr=x;
????
for(u=0;u<5;u++)
{
printf("%d-",x[u]);
}
printf("\n");
}
Which of the following statement could replace the given???? In the code above to
cause the string 1-2-3-10-5- to be printed when the code is execute.
(a)*ptr+3=10 (b)*ptr[3]=10
(c) *(ptr+3)=10 (d)*(ptr)[3]=10
Q26. What will be the output of following C program?
#include <stdio.h>
#include <string.h>
union Data
{
int i;
float f;
char str[20];
};
int main( )
{
union Data data;
printf( " %d\n", sizeof(data));
C Programming GATE-2020 Page 10
return 0;
}
(a)4 (b)8 (c)16 (d)20
Q27. What will be the output of following C program?
#include <stdio.h>
#include<stdio.h>
int main(){
int (*a)[5];
int arr[3][5]={ {10,65,30,40,50},{10,20,30,40,50} };
a = arr;
++a ;
char *ptr = (char*)*a;
++a ;
printf("%d %d %d",**a,*arr[1],*ptr);
return 0;
}
(a)0 10 10 (b)0 30 30 (c)0 40 50 (d)0 10 20
Q28. What will be the output of following C program?
#include<stdio.h>
int main(){
const array[2][3][3]={0,1,2,3,4,5,6,7,8,9,10,11,12};
int const (*ptr)[3][2][2]=&array;
printf("%d ",*(*(*ptr)[1]+3));
return 0;
}
(a)0 (b)8 (c)6 (d)7
Q29. What will be the output of following C program?
void main( )
{
struct emp
{
char name[20];
int age;
float sal;
};
struct emp e ={'Tiger'};
printf("\n%d %f",e.age,e.sal);
}
(A) 0 0.000000 (B) Garbage values
(C) Error (D) None of the above
C Programming GATE-2020 Page 11
Q30. What will be the output of following C program?
#include<stdio.h>
struct ZEAL210
{
char *name;
char street[10];
int pin;
}cus={"B-K","SAKET",452009},*p=&cus;
int main()
{
printf("%s %s",p->name,(*p).street);
return 0;
}
(A) Compilation Error (B) B-K SAKET
(C)Null NUll (D) Garbage values
Q31. What will be the output of following C program?
#include<stdio.h>
int main(){
static char *s[3]={"Math","phy","che"};
typedef char *( *ppp)[3];
static ppp p1=&s,p2=&s,p3=&s;
char * (*(*array[3]))[3]={&p1,&p2,&p3};
char * (*(*(*ptr)[3]))[3]=&array;
p2+=1;
p3+=2;
printf("%s",(***ptr[0])[0]);
return 0;
}
(A) Compilation Error (B) Math
(C)Phy (D)Invalid Memory Reference
Q32. What will be the output of following C program?
#include<stdio.h>
int main()
{
static float farray[][3]={0.0f,1.0f,2.0f,3.0f,4.0f,5.0f,6.0f,7.0f,8.0f};
float (*array[3])[3]={&farray[0],&farray[1],&farray[2]};
float (*(*ptr)[])[3]=&array;
printf("%f ",2[(*(**ptr+1))]);
return 0;
}
(A) Compilation Error (B) 5.000000
(C)6.000000 (D)Invalid Memory Reference
C Programming GATE-2020 Page 12
Q33. What will be the output of following C program?
#include <stdio.h>
#define SQUARE(a) (a)*(a)
int main() {
printf("%d\t", SQUARE(4));
int x = 3;
printf("%d\t", SQUARE(++x));
}
(A) Error (B) 16 25 (C)16 16 (D)16 9
Q34. What will be the output of following C program?
void main()
{
int c[ ]={2.8,3.4,4,6.7,5};
int j,*p=c,*q=c;
for(j=0;j<5;j++)
{
printf(" %d ",*c);
++q;
}
for(j=0;j<5;j++)
{
printf(" %d ",*p);
++p;
}
}
(A) 2 2 2 2 2 2 3 4 6 5 (B) 2 2 4 6 5
(C)2 2 2 2 2 4 6 5 (D)Compilation Error.
Q35. What will be the output of following C program?
#include <stdio.h>
main()
{
int i=-1,j=-1,k=0,l=2,m;
m=i++&&j++&&k++||l++;
printf("%d %d %d %d %d",i,j,k,l,m);
}
(A)Compilation Error (B) 0 0 1 3 1
(C)0 0 0 3 1 (D) 0 0 0 2 -1
C Programming GATE-2020 Page 13
Q36. What will be the output of following C program?
main()
{
char *p;
int *q;
printf("%d %d %d",sizeof(*p),sizeof(p),sizeof(*q));
}
(A)1 8 4 (B)1 4 4
(C) 4 4 8 (D) 1 4 8
Q37. What will be the output of following C program?
main()
{
printf("%2.2x",-1<<4);
}
(A) fffffffc (B) fffffff0
(C) ffffffff (D) ffff
Q38. What will be the output of following C program?
#include <stdio.h>
main()
{
struct ABC
{
int x;
struct ABC1
{
char s;
struct ABC *p;
};
struct ABC1 *q;
};
}
(A) Compilation Error (B)The Code Will not Generate Any Error
Q39. What will be the output of following C program?
main()
{
char *cptr,c;
void *vptr,v;
c=10; v=0;
cptr=&c; vptr=&v;
printf("%c%v",c,v)
}
(A )Compilation Error (B) 10 0
(C) 1 0 (D) 10 Null
C Programming GATE-2020 Page 14
Q40. What will be the output of following C program?
main()
{
int k=2;
printf ("%d==-1 is ""%s",k,k==-1?"TRUE":"FALSE");
}
(A ) 2== −1 is TRUE (B) 2== −1 is FALSE
(C) -1== −1 is TRUE (D) Compilation Error
Q41. What will be the output of following C program?
int i=100;
main()
{
extern int i;
{
int i=20;
{
const volatile unsigned i=20;
printf("%d\t",i);
}
printf("%d\t",i);
}
printf("%d\t",i);
}
(A )Compilation Error (B) 20 20 100
(C) 20 20 20 (D)20 100 100
Q42. What will be the output of following C program?
int main()
{
char a[] = "GATEATZEAL";
char b[20];
char *ps, *pt;
ps = a;
pt = b;
while(*pt)
*pt++ = *ps++;
*pt='\0';
printf("%s\n", b );
return 0;
}
(A )Compilation Error (B) GAT
(C)H I J (D) Invalid memory reference
C Programming GATE-2020 Page 15
Q43. What will be the output of following C program?
#include<stdio.h>
int main()
{
char *Zone[] = {"Zone-1", "Zone-2", "Zone-3"};
int **i = &Zone[0];
int **j = &Zone[1];
int ***k =&Zone[2];
printf("%c%c%c\n", **i,**j,**k);
return 0;
}
(A )Compilation Error (B) ZZZ
(C)Zon (D) Invalid memory reference
Q44. What will be the output of following C program?
#include<stdio.h>
int main()
{
char array[10] = "GATEATZEAL", *ptr, i, *ptr1;
ptr = &array[1];
ptr1 = ptr +20;
*ptr1 = 101;
for(i = 0; i < 10;i++)
printf("%c", *ptr++);
return 0;
}
(A )Invalid memory reference (B)GATEATZEAL
(C) ATEATZEAL (D) ATZEAL
Q45. What will be the output of following C program?
#include<stdio.h>
int main()
{
signed a;
unsigned b;
a = 5u + -10 + 14u + -6;
b = a + 1;
if(a == b)
printf("%d %d",a,b);
else
printf("%u %u",a, b);
return 0;
}
(A )0 1 (B)3 4
(C)4 5 (D) Compilation Error
C Programming GATE-2020 Page 16
Q46. What will be the output of following C program?
#include<stdio.h>
unsigned long int (*functionxyz())[5]
{
static unsigned long int arr[5] = {12, 13, 15, 17, 10};
printf("%d\t", *arr);
return &arr;
}
int main()
{
unsigned long int (*ptr)[5];
ptr = functionxyz();
printf("%d", *(*ptr + 2));
return 0;
}
(A) 12 15 (B)10 12 (C)12 14 (D) Compilation Error
Q47. What will be the output of following C program?
#include<stdio.h>
int main()
{
unsigned int num = -4;
printf("%d", ~num);
return 0;
}
(A)3 (B) 4 (C) -4 (D) Compilation Error
Q48. What will be the output of following C program?
#include<stdio.h>
#define sqr(x) ++x * ++x
int main()
{
int a = 3,z;
z = ++a * ++a;
a -= 2;
printf("%d %d",sqr(a),z);
return 0;
}
(A) 25 25
(B) 16 16
(C)9 9
(D) Compilation Error
C Programming GATE-2020 Page 17
Q49. What will be the output of following C program?
#include<stdio.h>
#include<string.h>
struct player
{
char pname[20];
}pl;
char* play(struct player *temp_pl)
{
strcpy(temp_pl->pname, "Sachin");
return temp_pl->pname;
}
int main()
{
int d=1;
d=d+++ ++d;
printf("%d\n",d);
strcpy(pl.pname, "dhoni");
printf("%s %s", pl.pname, play(&pl));
return 0;
}
(A) 4 Sachin Sachin (B) 4 dhoni dhoni
(C) 5 dhoni Sachin (D) Compilation Error
Q50. What will be the output of following C program?
#include<stdio.h>
int main()
{
short int si = 2;
switch(si+++si - ++si)
{
case 1:
printf("IIT");
break;
case 2:
printf("NIT");
break;
default:
printf("IIIT");
break;
}
return 0;
}
C Programming GATE-2020 Page 18
(A) NIT (B) IIIT (C) IIT (D) Compilation Error
Q51. What will be the output of following C program?
#include <stdio.h>
/* Function declarations */
int add(int, int);
int sub(int, int);
int main()
{
int sum, diff;
int (* arith)(int, int); // Function pointer declaration
arith = add; // Function pointer arith points to add()
sum = arith(10, 20); // Call add() using function pointer
arith = sub; // Function pointer arith points to sub()
diff = arith(100, 30); // Call sub() using function pointer
printf("%d\t", sum);
printf("%d", diff);
return 0;
}
/* Function definition */
int add(int num1, int num2)
{
return (num1 + num2);
}
int sub(int num1, int num2)
{
return (num1 - num2);
}
(A) 30 30 (B) 30 70
(C)30 130 (D) Compilation Error
Q52. What will be the output of following C program?
#include<stdio.h>
#include<stdlib.h>
int main()
{
struct test
{
C Programming GATE-2020 Page 19
int i;
float f;
char c;
};
struct test *ptr;
ptr = (struct test *)malloc(sizeof(struct test));
ptr ->f = 5.5f;
printf("%f", ptr->f);
return 0;
}
(A) Invalid Memory reference (B)5.500
(C) 5.500000 (D) Compilation Error
Q53. What will be the output of following C program?
#include <stdio.h>
int main ()
{
int array[] = { 45, 67, 89 };
int *array_ptr = & array[1];
printf("%i\n", array_ptr[1]);
return 0;
}
(A)67 (B) 45 (C)89 (D) Compilation Error
Q54. What will be the output of following C program?
#include <stdio.h>
int main ()
{
int a;
int b;
int const * ptr_a;
int * const ptr_b;
ptr_a = & a;
* ptr_a = 42;
ptr_b = & b;
* ptr_b = 42;
printf("%d %d",a,b);
return 0;
}
(A)42 42 (B) Garbage value
(C)Run Time Error (D) Compilation Error
C Programming GATE-2020 Page 20