While going through the C11 standard document, I found that it is acceptable to put variable declarator in parentheses.
If, in the declaration ‘‘T D1’’, D1 has the form identifier then the type specified for ident is T. If, in the declaration ‘‘T D1’’, D1 has the form (D) then ident has the type specified by the declaration ‘‘T D’’. Thus, a declarator in parentheses is identical to the unparenthesized declarator, but the binding of complicated declarators may be altered by parentheses.
So I tried. I am using Clang with MSVC as back-end.
#include <stdio.h>
int main() {
int (a),(b),(c);
int p, q, r;
printf("Value of a, b, c is %d, %d, %d\n", a, b, c);
printf("Value of p, q, r is %d, %d, %d\n", p, q, r);
return 0;
}
It generated output like this.
PS D:\C> .\a.exe
Value of a, b, c is 0, 1, 1069425288
Value of p, q, r is 0, 0, 0
I really didn't understand what is happening here, when variable is declared in parentheses it is certainly holding different default values. Can anyone explain?