Write a program to show the usage of storage class:register.

/* Write a program to show the usage of storage class:register*/

#include <stdio.h>

#include<time.h>

void main()

{

    float v1;

    register float v2;

    clock_t s1,e1,s2,e2;

    s1=clock();

    for(v1=0.01;v1<=1000;v1+=0.01)

    {

        printf("%8.2f ",v1);

    }

    e1=clock();

    s2=clock();

 

    for(v2=0.01;v2<=1000;v2+=0.01)

    {

        printf("%8.2f ",v2);

    }

    e2=clock();

    printf("\nNormal processing : %f\n",(double)(e1-s1)/CLOCKS_PER_SEC);

    printf("\nRegister processing : %f\n",(double)(e2-s2)/CLOCKS_PER_SEC);

 

    getch();

}

Comments

Popular posts from this blog

Write a program to accept numerator and denominator and find the remainder without using modulus (%) operator using do..while loop.