viewtopic.php?f=38&t=8943
got me wondering about reusing a name for a variable in a function that shadows a variable at global scope.
Code: Select all
#include <stdlib.h>
#include <stdio.h>
int test1;
void myfunc(void);
int main(void)
{
myfunc();
}
void myfunc(void)
{
static char test1[32] = { 0 };
}
Code: Select all
testshadow.c:15:17: warning: declaration shadows a variable in the global scope [-Wshadow]
15 | static char test1[32] = { 0 };
| ^
testshadow.c:4:5: note: previous declaration is here
4 | int test1;
| ^
1 warning generated.