Consider the program given below.
#include<stdio.h>
int main()
{
typedef static int i;
i a = 0;
printf("%d", a);
return 0;
}
The program when compiled as C or C++ will give you the following error "multiple storage classes in declaration specifiers". The error tells us that typedef in C and C++ is treated as a storage class specifier and this leads to the error since it is not allowed to use two storage class specifiers with a variable.
The C Reference Manual says "The typedef specifier does not reserve storage and is called a storage class specifier only for syntactic convenience".
The C Reference Manual says "The typedef specifier does not reserve storage and is called a storage class specifier only for syntactic convenience".
No comments:
Post a Comment