gpt4 book ai didi

c++ - 在 C++ 中返回一个字符串

转载 作者:太空宇宙 更新时间:2023-11-04 15:52:54 24 4
gpt4 key购买 nike

我在我的 C++ 中有一个函数,我想在其中返回一个字符串。我尝试了几种方法但出现错误。我试过 C# 方式返回“....”;返回我的字符串;但是每次都会出错。

编辑:

TestConsoleApp2.exe 中 0x100c1486 (DGGGGG.dll) 处的未处理异常:0xC0000005:访问冲突写入位置 0x7a0dcc30。

最佳答案

std::string methodReturningString()
{
std::string something = "Hello ";
something += "world!";
return something;
}

关于c++ - 在 C++ 中返回一个字符串,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5027253/

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