#include<stdio.h>
int f(char *cS)
{
int nK=0;

while(*cS)
nK=nK*10+*cS++;
return(nK);
}
void main()
{
printf("%d",f("1234"));
} The answer is 54562
#include<stdio.h>
int f(char *cS)
{

int nK=0;
while(*cS)
nK=nK*10+*cS++-'0';
return(nK);
}
void main()
{
printf("%d",f("1234"));
}

The answer is 1234.why ah who can explain each step?
I am building a lot of aloe web site with a lot of programming problems. -http://www.okyalo.com/
Modifié par Felipe (27 Apr 2017 - 10:13)