Search found 1 match

by null
22 Mar 2011, 14:12
Forum: Limbajul C++
Topic: Cum ati implementa functia atoi()?
Replies: 27
Views: 16058

Re: Cum ati implementa functia atoi()?

Bucla: while(isdigit(*p)) { result = 10 * result + *p - '0'; p++; /* next digit */ } ar putea fi scrisa ca: unsigned int d; while(*p && (d = *p -'0') < 10) { result = 10 * result +d; p++; /* next digit */ } reducand numarul de operatii in plus prin folosirea lui isdigit().