C Programming Reference


C Programming Reference >> C Basic Tutorials >> C Keywords Home >>

registerui

30/12/06 -  Views - Ratings :   3.48 of 5 / 155 Votes

Its a storage class specifier . Variable marked as register will be save into CPU register rather than CPU memmory leading to very fast access. Normally int and char gets benfit from register modifier and also only limited numbers of variables can be simultaneously stored in register. These type and number are highly machine dependent. Also register is just an request to compiler and can be completely ignored. Register varaibles cannot be addresed using pointers. Generally loop control variable are made register variables.

Code -
void function (void)
{
register int a;
for (a = 0; a < 10;a++)
 {
   printf ("%d", a); \\ Prints numbers 0 to 9

 } 
}

Back To Top


      

 

 

© 2006 cencyclopedia.com