I have read online and in print (the ANSI C book by Kochan) that one cannot use the dollar sign $
in a variable name when programming in C. Yet, when I created the following code to test variable names as part of exercise 2 in chapter 4 of Kochan's book I am able to compile and run the code.
So, is GCC breaking the rules by allowing $
or have the rules for variable names been changed to allow for the $
?
Here is my terminal output:
user@computer# cat Answer-4_2_for_post.c
#include <stdio.h>
int main()
{
int A$;
A$ = 1;
printf ("variable A$ = %i\n",A$);
return 0;
}
user@computer# gcc ./Answer-4_2_for_post.c -o ./Answer-4_2_for_post
user@computer# ./Answer-4_2_for_post
variable A$ = 1
user@computer#
gcc -std=c11 -pedantic-errors -Wall -Wextra ./Answer-4_2_for_post.c -o ./Answer-4_2_for_post
I also found this.