3 votes 3 votes Q)What is the output of the following C program fragment?Assume size of an integer is 4 Bytes #include<stdio.h> int main() { int i = 5; int var = sizeof( i++); printf("%d %d",i ,var); return 0; } A) 5 4 B) 6 4 C) 5 8 D)Compiler Error Programming in C programming-in-c + – Lakshman Bhaiya asked Apr 23, 2018 Lakshman Bhaiya 964 views answer comment Share Follow See all 0 reply Please log in or register to add a comment.
6 votes 6 votes int i=5 int var= sizeof(i++); But sizeof(variable), variable will not be evaluated until it is variable length array type. so i++ will not be incremented ==>> as sizeof is compile time operator so during compilation value will be generated and hence not evaluted during run time answer:- 5,4 https://stackoverflow.com/questions/8225776/why-does-sizeofx-not-increment-x Thanks srestha for corrrection sonveer tomar 1 answered Apr 23, 2018 • edited Jun 1, 2018 by sonveer tomar 1 sonveer tomar 1 comment Share Follow See all 3 Comments See all 3 3 Comments reply srestha commented Apr 23, 2018 reply Follow Share it is giving 5,4 https://ideone.com/U5PuW9 0 votes 0 votes sonveer tomar 1 commented Apr 23, 2018 reply Follow Share sorry, i thought it is simple c program. Thank you for commenting 0 votes 0 votes Mayankprakash commented Jul 15, 2018 reply Follow Share @srestha and @sonveer Please can you explain what does it mean size of is compile time operator so value will be generated at compile time not run time . Please suggest. Thanks 0 votes 0 votes Please log in or register to add a comment.