Explanation: In the above C code, We are trying to compare a signed int variable “var” with size_t, which is defined as an unsigned long int (sizeof operator return size_t). Here integer promotion occurs and the compiler will convert signed int -3 to unsigned long int and resultant value would very large as compare to int size. So the for loop condition will be false and there won’t be any iteration.
Output:
Nothing will print.
Explanation: In the above C code, We are trying to compare a signed int variable “var” with size_t, which is defined as an unsigned long int (sizeof operator return size_t). Here integer promotion occurs and the compiler will convert signed int -3 to unsigned long int and resultant value would very large as compare to int size. So the for loop condition will be false and there won’t be any iteration.
need an explanation for this answer? contact us directly to get an explanation for this answer