#include<stdio.h>>
int main()
{
int x=100;
printf("x=%d\nsizeof(x++)=%d\nx=%d\n",x,sizeof(x++),x);
return 0;
}
Solution
x=100
sizeof(x++)=4
x=100
The x value is not incremented after the x++ operation.because the increment operation performed inside the sizeof operator doesn't change the value of x.
The 'sizeof' operator is used to determine the amount of space anydata-element/datatype occupies in memory
sizeof(x++)=4
x=100
The x value is not incremented after the x++ operation.because the increment operation performed inside the sizeof operator doesn't change the value of x.
The 'sizeof' operator is used to determine the amount of space anydata-element/datatype occupies in memory
2.What is the output of the following program?
#include<stdio.h>>
int main()
{>
int x=10;
printf("x1=%d\n",printf("x2=%d\n",printf("x3=%d\n",x)));
return 0;
}
Solution
x3=10
x2=6
x1=5
The output function printf returns the number of characters printed.
x2=6
x1=5
The output function printf returns the number of characters printed.
x=100
sizeof(x++)=4
x=100
The x value is not incremented after the x++ operation.because the increment operation performed inside the sizeof operator doesn't change the value of x.
The 'sizeof' operator is used to determine the amount of space anydata-element/datatype occupies in memory
sizeof(x++)=4
x=100
The x value is not incremented after the x++ operation.because the increment operation performed inside the sizeof operator doesn't change the value of x.
The 'sizeof' operator is used to determine the amount of space anydata-element/datatype occupies in memory
I can not understand the output of question 2. please explain.
ReplyDeleteplease explain questin 2
ReplyDelete