Aspire Faculty ID #12757 · Topic: JECA MCA 2023 · Just now
JECA MCA 2023

What is the output of the following C program?

#include <stdio.h>
void main(){
  int a = -7;
  float b;
  b = a++;
  printf("%d, %f ", a, ++b);
}

Solution

Explanation: The statement b = a++; assigns the current value of a (−7) to b and then increments a to −6. Later, ++b increments b from −7 to −6 before printing. $$ a = -6,\quad b = -6.000000 $$

Previous 10 Questions — JECA MCA 2023

Nearest first

Next 10 Questions — JECA MCA 2023

Ascending by ID
Ask Your Question or Put Your Review.

loading...