0
Why static variables are initialized by only constant? Why we can't initialized it by a other variables?
3 Respuestas
0
What do you mean?
#include <stdio.h>
int main() {
static int p;
int c = 12;
p = c;
printf("%d", p);//12
return 0;
}
0
if we use -
int c=12;
static int p=c;
// Compiling error
0
Do this-
int c = 12;
static int p;
p = c;
You have to declare static first then initialize it.