increment
#include <stdio.h>
int main()
{
int apple = 20;
printf("%d\n", apple);
apple++;
printf("%d\n", apple);
return 0;
}
decrement
#include <stdio.h>
int main()
{
int apple = 20;
printf("%d\n", apple);
apple--;
printf("%d\n", apple);
return 0;
}
increment
int main()
{
int apple = 20;
printf("%d\n", apple);
apple--;
printf("%d\n", apple);
return 0;
}
increment
#include <stdio.h>
int main()
{
int apple = 20;
printf("%d\n", apple);
++apple;
printf("%d\n", apple);
return 0;
}
How before and after differs
#include <stdio.h>
int main()
{
int a = 5, b = 10, answer = 0;
answer = ++a *b ;
it changes the value of a before it changes the equation.
printf(" Answer: %d \n", answer);
here reset and get rid of int variable.
a = 5, b = 10, answer = 0;
answer = a++ *b ;
++after a it runs the current value and then do the increment.
printf(" Answer: %d \n", answer);
return 0;
}
See my youtube channel for more explanation on this :).
int main()
{
int apple = 20;
printf("%d\n", apple);
++apple;
printf("%d\n", apple);
return 0;
}
How before and after differs
#include <stdio.h>
int main()
{
int a = 5, b = 10, answer = 0;
answer = ++a *b ;
it changes the value of a before it changes the equation.
printf(" Answer: %d \n", answer);
here reset and get rid of int variable.
a = 5, b = 10, answer = 0;
answer = a++ *b ;
++after a it runs the current value and then do the increment.
printf(" Answer: %d \n", answer);
return 0;
}
See my youtube channel for more explanation on this :).
Comments
Post a Comment