392 views
0 votes
0 votes
#include<stdio.h>
int main()
{
    int i=10;
    register *a=&i;
    printf("%d",*a);

    return 0;
}
................................................................................................................................................................................................

#include<stdio.h>
int main()
{
    int i=10;
    static *a=&i;
    printf("%d",*a);

    return 0;
}
 

 

 

 

my question is register and static both are storage classes so by using register program is executing but why not using static please explain ?

1 Answer

0 votes
0 votes
Hi,

As far I know with register it should give run time error as address of register is not stored by pointer.Pointers stores address of memory

Related questions

0 votes
0 votes
0 answers
1
Sgm asked Dec 28, 2022
385 views
Any one please let me know if there is any other way to this output?
0 votes
0 votes
0 answers
3
Prince Sindhiya asked Oct 23, 2018
252 views
i am getting 36 please confirm given answer is 15