gpt4 book ai didi

c - 获取错误-C编程

转载 作者:行者123 更新时间:2023-12-03 09:12:40 24 4
gpt4 key购买 nike

尝试在VB中运行此简单的C程序代码时遇到这些错误。需要帮助纠正他们。

C2371 'CopySubString': redefinition;different basic types
这是代码:
// --------------------------------------------------------------------------------
// Name: CopySubString
// Abstract: Copy substring from source string to destination string
// --------------------------------------------------------------------------------
int CopySubString(char strDestination[], char strSource[], int intStartIndex, int intEndIndex)
{
int intCount = 0;
int intIndex = 0;

for (intIndex = intStartIndex; intIndex <= intEndIndex; intIndex += 1)
{
strDestination[intCount] = strSource[intIndex];

intCount = +1;
}

return strDestination[intCount];
}

最佳答案

我相信下面这行是有问题的:

intCount = +1;
如下更改,然后重试。
intCount += 1;

关于c - 获取错误-C编程,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62886883/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com