作者tata111 (aa)
看板C_and_CPP
标题[问题] pointer与putchar
时间Sat Feb 21 23:05:14 2009
刚刚看到一个范例一直不知道它是怎麽作用的
为什麽可以把两个动作写在一起?
void putstr2(char *s){
while(*s){
putchar(*s++);
}
}
要是我的话会是下面这种写法
先输出一个字元後再移动指标
void putstr3(char *s){
while(*s){
putchar(*s);
s++;
}
}
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 220.136.219.75
1F:推 hilorrk:不是一样吗 i++会先丢出i再++ 02/21 23:18
2F:→ hilorrk:如果是++i 就是先++再丢出i 02/21 23:19