inline int scan_d(void){
int n=0,s=1;
char p=get();
if(p=='-') s=-1;
while((p<'0'||p>'9')&&p!=EOF&&p!='-') p=get();
if(p=='-') s=-1,p=get();
while(p>='0'&&p<='9') { n = (n<< 3) + (n<< 1) + (p - '0'); p=get(); }
return n*s;
}
Can someone please help me out with the above function?
Actually I needed some help for my project and came across this function while searching the internet. This has been used in case of scanf that is taking the input from console.
I am not able to understand the logic.
Aucun commentaire:
Enregistrer un commentaire