Program :
#include
main()
{
int i=20,j;
j=i--; /* j value 20 , i value 21*/
/*post decrement*/
printf("\n After post-decrement: j value: %d , i value:%d \n",j,i);
j=--i; /* j value 22, i value 22*/
/*pre-decrement*/
printf("\n After pre-decrement: j value: %d, i value:%d \n",j,i);
return(0);
}
Output :
#include
main()
{
int i=20,j;
j=i--; /* j value 20 , i value 21*/
/*post decrement*/
printf("\n After post-decrement: j value: %d , i value:%d \n",j,i);
j=--i; /* j value 22, i value 22*/
/*pre-decrement*/
printf("\n After pre-decrement: j value: %d, i value:%d \n",j,i);
return(0);
}
No comments:
Post a Comment