I
int main(void)
Hi all,
I know that register variables work fine at block scope.
I tried putting a register variable in file scope, like this,
#include <stdio.h>
register int a = 2;
int main(void)
{
printf("%d\n",a);
}
But my compiler gives me an error,
error: register name not specified for 'a'
Now, i have 2 questions
1) Why is it not possible to have register variables at file scope ?
2) Is it necessary that a variable should be made register variable
(or) automatically compiler will make it register variable if it is
neccessary.
Regards,
Yugi.
I know that register variables work fine at block scope.
I tried putting a register variable in file scope, like this,
#include <stdio.h>
register int a = 2;
int main(void)
{
printf("%d\n",a);
}
But my compiler gives me an error,
error: register name not specified for 'a'
Now, i have 2 questions
1) Why is it not possible to have register variables at file scope ?
2) Is it necessary that a variable should be made register variable
(or) automatically compiler will make it register variable if it is
neccessary.
Regards,
Yugi.