R
raghu
#include<stdio.h>
register int i=9;
int main(void)
{
register int i=8;
int *p;
p=&i;
printf("%d",*p);
return 0;
}
I compiled this code in Turbo C/C++.It gave two errors as: Register int
cant be used as global and pointer cant be applied to the register int.
When I compiled the same in Miracle C compiler it compiled succesfully
and gave output as 8.
I think Turbo C/C++ compiler is correct as I have read in books that
pointer cant be applied variables of register storage class.
Why this differentiation in compilers?
Dont they follow the same rules of C?
Please help.
Regards,
Raghu
register int i=9;
int main(void)
{
register int i=8;
int *p;
p=&i;
printf("%d",*p);
return 0;
}
I compiled this code in Turbo C/C++.It gave two errors as: Register int
cant be used as global and pointer cant be applied to the register int.
When I compiled the same in Miracle C compiler it compiled succesfully
and gave output as 8.
I think Turbo C/C++ compiler is correct as I have read in books that
pointer cant be applied variables of register storage class.
Why this differentiation in compilers?
Dont they follow the same rules of C?
Please help.
Regards,
Raghu