I am using a struct like:
struct{
int a;
char b[100];
}name;
I want to use static storage class specifier on name.
How can I do that?
use the word static in front of it:
static struct{
int a;
char b[100];
} name;
This will declare a variable named name with the type struct { ... } and the storage class specifier static.
To initialize the member of the struct, you can use
static struct{
int a;
char b[100];
} name = {5};
name like name.a = 1, it shows error saying unknown type name ‘name’. Also, I am doing this globally.name.a = 5; can only be in a function. Do you want to initialize it?