in turboc++
-------------------------------------------------------------------------------
//program to understand register variable .
#include <stdio.h>
#include <stdlib.h>
#include<conio.h>
void function();
int main()
{
function();//function calling
getch();
return 0;
}
void function()//function body line
{
register int a=4;//local variable, it can not be accessed from outsides and stored in RAM. We can store that in register location
register float b=7.89;//local variable// can not be accessed from outsides stored in register
printf("a=%d,b=%f",a,b);//printing value
}
/*note:
If we declare variable as register then it is stored in register and not not RAM. Its execution becomes faster.
*/
-------------------------------------------------------------------------------
in codeblocks:
-------------------------------------------------------------------------------------------
//program to understand register variable .
#include <stdio.h>
#include <stdlib.h>
void function();
int main()
{
function();//function calling
return 0;
}
void function()//function body line
{
register int a=4;//local variable, it can not be accessed from outsides and stored in RAM. We can store that in register location
register float b=7.89;//local variable// can not be accessed from outsides stored in register
printf("a=%d,b=%f",a,b);//printing value
}
/*note:
If we declare variable as register then it is stored in register and not not RAM. Its execution becomes faster.
*/
-------------------------------------------------------------------------------
//program to understand register variable .
#include <stdio.h>
#include <stdlib.h>
#include<conio.h>
void function();
int main()
{
function();//function calling
getch();
return 0;
}
void function()//function body line
{
register int a=4;//local variable, it can not be accessed from outsides and stored in RAM. We can store that in register location
register float b=7.89;//local variable// can not be accessed from outsides stored in register
printf("a=%d,b=%f",a,b);//printing value
}
/*note:
If we declare variable as register then it is stored in register and not not RAM. Its execution becomes faster.
*/
-------------------------------------------------------------------------------
in codeblocks:
-------------------------------------------------------------------------------------------
//program to understand register variable .
#include <stdio.h>
#include <stdlib.h>
void function();
int main()
{
function();//function calling
return 0;
}
void function()//function body line
{
register int a=4;//local variable, it can not be accessed from outsides and stored in RAM. We can store that in register location
register float b=7.89;//local variable// can not be accessed from outsides stored in register
printf("a=%d,b=%f",a,b);//printing value
}
/*note:
If we declare variable as register then it is stored in register and not not RAM. Its execution becomes faster.
*/
No comments:
Post a Comment