- 相關(guān)推薦
LENOVO筆試題
1.設(shè)計函數(shù) int atoi(char *s),
LENOVO筆試題
。int atoi(char *s)
{
char sign;
char sign_val = 1;
int val = 0;
int n = 0;
/* skip spaces */
while (isspace(*s))
++s;
if (*s == '-' || *s == '+')
/* skip '-' and '+' sign */
{
sign = *s;
if (sign == '-')
sign_val = -1;
++s;
}
/* when goes here, it is not space or sign */
while ((*s != '\0') && isdigit(*s))
{
val = 10 * n + (*s - '0');
n = val;
s++;
}
if (*s != '\0')
{
printf("non digit in your input!!\n");
exit(-1);
}
/* non error occured */
return (sign_val * val);
}
2.int i=(j=4,k=8,l=16,m=32); printf("%d", i); 輸出是多少?
結(jié)果為: 32.
【LENOVO筆試題】相關(guān)文章:
360筆試題目06-27
聯(lián)想(lenovo)筆試筆試經(jīng)驗06-08
筆美國國家儀器試題目09-23
搜狐產(chǎn)品筆歸分享筆試題目07-05
新浪筆經(jīng)04-27
新聞總署筆經(jīng)10-13
IBM公司筆經(jīng)09-15
營銷卷筆經(jīng)10-25
科勒筆經(jīng)09-23