[Updated] Goldman Sachs Aptitude Test Questions and Answers
Practice List of TCS Digital Coding Questions !!!
Take 50+ FREE!! Online Data Interpretation Mock test to crack any Exams.

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!