Program
#include <stdio.h>
main()
{
register int i = 0; \\ A
for( i=0;i<2;i++)
{
printf("value of i is %d\n",i);
}
}
Explanation
- Here the register allocation directive is given for variable i. During execution, i will be allocated a register if it is available; otherwise, i will receive normal memory allocations.
- You can use a register directive only for variables of the automatic storage class, not for global variables.
- Generally, you can use register storage for int or char data types.
No comments:
Post a Comment