ASP ScriptingJava ScriptingCGI ScriptingHTMLJavaLanguage CERP Education Links

LANGUAGE C

Storage Class, Auto, Extern, Static, Register

  Automatic Variables

     Any variable declared within a functuion or a code block are automatically assumed to be of the class auto and the system sets aside the required memory area for them.

  Register Variables

     Registers are used to temporarily store data that has to be accessed repeatedly. Intermediate results of calculations are also stored in registers. Operations can be performed upon the data stored in memory. In C, the option of choosing a storage location for a value has been left to the programmer.

     If a particular value is to be used often its storage class named as register. Then, if the compilers finds a free register, and if the machine's registers are big enough to hold the variable, it is placed in that register.

#include <stdio . h> 
main ()
{
register int i;
int no, digit, sum;
printf ("\nThe numbers whose Sum of Cubes of Digits ");
printf ("\nis Equal to the no. itself are: \n\n");
for (i =1; i <=999; i++) 
{
sum = 0;
no = i; 
while (no)
{
digit = no % 10;
no = no/10;
sum = sum + digit * digit * digit;
if(sum==i)
printf("\t %d\n", i);
}
}

 


Your Ad Here
Not All Of Your Subscribers Use RSS - AWeber Email Marketing
Your Ad Here