下面的代码预计会打印“kevin”但是,它正在打印垃圾值。我已经检查了调试器。“operatorchar*”调用返回的指针无效。有什么想法吗?classWrapper{private:char*_data;public:Wrapper(constchar*input){intlength=strlen(input)+1;_data=newchar[length];strcpy_s(_data,length,input);}~Wrapper(){delete[]_data;}operatorchar*(){return_data;}};intmain(){char*username=Wr
这个问题在这里已经有了答案:Singlequotesvs.doublequotesinCorC++(14个答案)关闭3年前。但问题是,我声明的char数组中的初始值设定项数量正好。chardash[9][9]={{"1","2","3","4","5","6","7","8","9"},{"a","b","c","d","e","f","g","h","i"},{"q","w","e","r","t","y","u","i","o"},{"9","8","7","6","5","4","3","2","1"},{"i","h","g","f","e","d","c","b","a"},