由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Programming版 - function call?
相关主题
reverse words, not the Microsoft one!!!请教一个简单字符串程序 (转载)
c++ 得最基本问题为什么foo1可以而foo2不行?
来,出个题菜鸟求教,一个c++的困惑
question about shiftPlease help me take a look at the program
一个指向指针的指针的引用?C++ formatted output question
问个char*的问题问个指针array 的简单问题
A aimple C++ question这个在c++ const不变,不能用相同地址的变量改,咋做的
这个地址咋回事?A try-catch problem in C++
相关话题的讨论汇总
话题: str话题: int话题: afdd话题: shift话题: char
进入Programming版参与讨论
1 (共1页)
h**l
发帖数: 168
1
The following code with function call can shift a string but the code
without function call can not. What might be the problem? Thanks!
_______________________________________________________
void shift(char a[])
{
int i=0;
while(a[i]) a[i] = a[++i];
}
int main()
{
char str[]= "afdd";
shift(str);
cout< return 0;
}
_____________________________________________________________
int main()
{
char str[]= "afdd";
int i=0;
while(str[i]) str[i] = str[++i];
cout< return 0;
}
___________________________________________
p***o
发帖数: 1252
2
a[i]=a[++i] is undefined. Change it to {a[i]=a[i+1];++i;}

【在 h**l 的大作中提到】
: The following code with function call can shift a string but the code
: without function call can not. What might be the problem? Thanks!
: _______________________________________________________
: void shift(char a[])
: {
: int i=0;
: while(a[i]) a[i] = a[++i];
: }
: int main()
: {

h**l
发帖数: 168
3
I see. Thanks.

【在 p***o 的大作中提到】
: a[i]=a[++i] is undefined. Change it to {a[i]=a[i+1];++i;}
1 (共1页)
进入Programming版参与讨论
相关主题
A try-catch problem in C++一个指向指针的指针的引用?
a simple question for C++ class问个char*的问题
which func will be called?A aimple C++ question
请问一个exception题目这个地址咋回事?
reverse words, not the Microsoft one!!!请教一个简单字符串程序 (转载)
c++ 得最基本问题为什么foo1可以而foo2不行?
来,出个题菜鸟求教,一个c++的困惑
question about shiftPlease help me take a look at the program
相关话题的讨论汇总
话题: str话题: int话题: afdd话题: shift话题: char