Hi
Today I found a new (or probably) bad thing. I use to call fuction for
anything I need. But It takes valuable time taking value and returning
something.
:(
// This code describe how bad , calling fuction is...
#include <stdio.h>
#include <time.h>
unsigned long int fuction(long long i)
{
// Do something ...
return i ;
}
int main()
{
unsigned long long i;
time_t end, start;
start = clock() ;
for(int i=0; i<1000; i++)
for(int j=0; j<1000; j++)
for(int k=0; k<1000; k++) ;
end = clock() ;
printf("IN MAIN FUNCTION ... \n ") ;
printf("\t Total clock : %u \n", end-start) ;
start = clock() ;
for(int i=0; i<1000; i++)
for(int j=0; j<1000; j++)
for(int k=0; k<1000; k++)
fuction(i) ;
end = clock() ;
printf("IN SUB FUNCTION .... \n") ;
printf("\t Total clock : %u \n ", end-start ) ;
printf("\nFunctions take a lot of time :( " ) ;
return 0 ;
}
Now , I just want to know is this a good practice to work and utilize
function calling? Or I'm just gonna work with main?
--
Shamir Shakir Shishir
http://DewsWorld.t35.com
:::::.......... Hope never ends...........:::::
[Non-text portions of this message have been removed]