【发布时间】:2023-02-13 11:18:45
【问题描述】:
所以我有这个带表的 strcpy,但我需要更改它,以便没有表,只有指针。当我尝试这样做时,出现错误(我把 $$ 放在前面)
所以原来的:
#include <iostream>
using namespace std;
int main() {
char *mon_strcpy(char destination[], char source[]) {
int index = 0;
while (source[index] != '\0') {
destination[index] = source[index];
index++;
}
destination[index] = '\0';
return destination;
}
return 0;
}
这是我试图让它发挥作用的那个:
#include <iostream>
using namespace std;
int main() {
char *mon_strcpy(char *destination, char *source) $${
int index = 0;
while (*source != '\0')
{
*destination = *source;
index++;
}
*destination = '\0';
return destination;
}
return 0;
}
我无法全神贯注地寻找问题所在……TIA
【问题讨论】:
标签: c++