- 论坛徽章:
- 0
|
第二题考虑符号...我实在是...不行了...
- void
- exchange(int *a, int *b, int *c)
- {
- *a = *a + *b + *c;
- *c = *a - *b - *c;
- *b = *a - *b - *c;
- *a = *a - *b - *c;
- }
复制代码
8行...我实在想不出来了...如果不要求代码格式...估计5行..还有点希望....
- void
- atoi(char *str, int *rc)
- {
- *rc = 0;
- if (str == NULL)
- return ;
- int sign = (*str != '-' ? 1 : 0); /* only for ... c99 */
- str = (*str == '-' || *str == '+') ? str + 1 : str;
- while ((*str) && isdigit(*str))
- *rc = *rc * 10 + (*str++ - '0');
- *rc = (sign) ? *rc : -*rc;
- }
复制代码
[ 本帖最后由 Edengundam 于 2007-2-12 17:50 编辑 ] |
|