Take FREE!! Online Mettl Mock Test to Crack TechM and Other Companies Written Exams.
Get Off-Campus Placement Jobs Info !!!
TCS NQT Technical and Managerial Round Interview Questions

C Programming :: Const / Volatile Qualifier - Discussion

Home > C Programming > Const / Volatile Qualifier > MCQs Questions Discussion

5 / 10

What is the output of the following 'C' program ?

#include <stdio.h>
#define SIZE 3 
void fun(int *ptr)
{
*ptr = *ptr + 1;
}
int main()
{
int oldval;
const int newval = 0;
static int temp = 99;
int i;
for (i=0;i< SIZE;i++)
{
oldval = newval; 
newval = i; 
fun(&temp);
}
printf("%d %d %d",oldval,newval,temp);
}

ACompilation error: assignment of read-only variable

B1 2 102

C1 3 103

DGarbage Value

Answer: Option (Login/Signup)

Show Explanation

Asked In ::

Post Your Answer Here:     

No Discussion on this question yet!