#include <stdio.h>
void foo(auto int i); // line 3
int main()
{
foo(10);
}
void foo(auto int i) // line 13
{
printf("%d\n", i );
}
What is wrong in this code? This program is not compiling.
Errors I am seeing are as follows:
main.c:3:27: error: storage class specified for parameter 'i'
void foo(auto int i);
main.c:13:27: error: storage class specified for parameter 'i'
void foo(auto int i)
The only storage class specifier that is valid in a parameter declaration is register, we can see this from the draft C99 standard section
6.7.5.3
Function declarators (including prototypes) paragraph 2 which says:this is section
6.7.6.3
in C11.the storage class specifiers from section
6.7.1
Storage-class specifiers are as follows: