Use app×
Join Bloom Tuition
One on One Online Tuition
JEE MAIN 2025 Foundation Course
NEET 2025 Foundation Course
CLASS 12 FOUNDATION COURSE
CLASS 10 FOUNDATION COURSE
CLASS 9 FOUNDATION COURSE
CLASS 8 FOUNDATION COURSE
0 votes
266 views
in Information Technology by (72.7k points)
closed by
Expression C = i++ causes
1. value of i to be assigned to C, and then I to be incremented by 1
2. I to be incremented by 1, and then value of i to be assigned to C 
3. value of i to be assigned to C
4. i to be incremented by 1

1 Answer

0 votes
by (121k points)
selected by
 
Best answer
Correct Answer - Option 1 : value of i to be assigned to C, and then I to be incremented by 1

Concept:

Meaning of i++:

First, we read the i than after reading the value of i we are going to increment i this is nothing but post-increment.

Meaning of ++i: 

First, we increment i than we read the value of I, this is nothing but pre-increment:

Examine code:

int main( )
{
int i = 10;
int C = i++;   // assign i to C therefore C = 10 after assigning increment i by 1
printf("i = %d, C =  %d", i, C);
return 0;
}

Output:

i = 11, C =  10

Therefore value of i to be assigned to C, and then I to be incremented by 1

Welcome to Sarthaks eConnect: A unique platform where students can interact with teachers/experts/students to get solutions to their queries. Students (upto class 10+2) preparing for All Government Exams, CBSE Board Exam, ICSE Board Exam, State Board Exam, JEE (Mains+Advance) and NEET can ask questions from any subject and get quick answers by subject teachers/ experts/mentors/students.

Categories

...