Mega Code Archive

 
Categories / C Tutorial / Operator
 

The decrement operator

#include <stdio.h> #include <stdlib.h>   int main() {     char weight[4];     int w;       printf("Enter your weight:");     gets(weight);     w=atoi(weight);       printf("Here is what you weigh now: %i\n",w);     w--;     printf("w++: %i\n",w);     w--;     printf("w++: %i\n",w);     return(0); } Enter your weight:123 Here is what you weigh now: 123 w++: 122 w++: 121