Open In App

QA – Placement Quizzes | SP Contest 2 | Question 3

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

Article Tags :