Explain ‘register’ storage class.


main( )

{

register int a, *p1, *p2 ;

int b ;

clrscr( ) ;

p1 = &a ;

p2 = &b ;

printf ( “%u %u”, p1, p2 ) ;

getch( ) ;

}

Here, a is an integer variable, p1 and p2 are pointers. These all variables are of register storage class. This program would flash a compiler error because we are storing address of a register variable. Register variables don’t have address. However, it’s all right to store an address in a register variable. In other words, a register variable can be a pointer, but it can’t be pointed to.

Subscribe / Share

It's very calm over here, why not leave a comment?

Leave a Reply




Categories

Powered by Yahoo! Answers