Looking at wikipedia it says:
a -= b;
is the same as
a = a - b;
But when I try this in my C program I get the following error:
"error: redefinition of 'a'".
Here is my program:
#include <stdio.h>
int main(int argc, char *argv[])
{
int a = 10;
int a -= 5;
printf("a has a value of %d\n", a);
return 0;
}
I received the following errors:
my_prog.c:6:6: error: redefinition of 'a' int a -= 5; ^ my_prog.c:5:6: note: previous definition is here int a = 10; ^ my_prog.c:6:8: error: invalid '-=' at end of declaration; did you mean >'='? int a -= 5; ^~
I am using clang on Mac.