Open In App

QA – Placement Quizzes | SP Contest 2 | Question 3

Like Article
Like
Save
Share
Report

What will be the output of the below C program:




int calc(int i)
{
      
    while(++i > 10); // statement 0
      
    i++;
      
    return i;
}
  
int main() {
    int i = 2;
      
    printf("%d", calc(i));
      
    return 0;
}


Also, if we replace pre-increment operator by post-increment operator in statement 0, then what will be the output of the new program?

(A) 11 and 12
(B) 12 and 11
(C) 4 and 5
(D) 4 and 4


Answer: (D)

Explanation:

Quiz of this Question
Please comment below if you find anything wrong in the above post


Last Updated : 18 Jul, 2018
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads