error+c2440
答:CString::GetBuffer()返回的类型是LPTSTR。我们查看LPTSTR的定义:<WINNT.H> ifdef UNICODE // r_winnt typedef LPWSTR PTSTR, LPTSTR;else /* UNICODE */ // r_winnt typedef LPSTR PTSTR, LPTSTR;endif /* UNICODE */ // r_winnt 在看LPWSTR和LPSTR的定义:<WINNT.H> ifndef _...
答:主函数中对每个结构体的赋值错误 s1.num=001;strcpy(s1.name,"Li Ming");//字符串赋值不能用s1.name="Li Ming";得用strcpy函数 s1.sex='F';s1.age=18;s1.score=82;strcpy(s1.addr,"xiaoqu1");//同理 s1.next=&s2;后面的修改一样 ...
答:不能转换 int类型为int指针类型 int a = 9 ; //ok int *pa = &a; //ok int *pa = 9 ;//error C2440 int *pa;pa = 8 ; //errorC4700 C4700 错误中 *pa 没有实际的指向位置,所以不能赋值 int *pa ;int a;pa = &a;pa = 1234; //ok ...
答:你的错误在于people这个结构中定义了string类型的成员,从而导致了不能用initializer list 进行初始化;什么情况能用initializer list 来进行初始化呢:(1)An array;数组 (2)A class, structure, or union that does not have constructors, private or protected members, base classes, or virtual ...
答://char 数组不支持=运算符,需要使用strcppy(des, src);函数,头文件#include<cstring>#include <iostream>#include <string>#include <cstring>using namespace std;struct Student{ int num; char name[20]; float score[3];};int main(){ void print(Student); Student stu; ...
答:错误说的很明确了,你用一个长度为3,数据类型为char的数组,给一个char变量赋值,当然是错的 char a="00";改成 char a[3]="00";或者 char *a="00";但考虑到你的 wchar_t getWeekName(wchar_t f);参数是wchar_t,而 typedef unsigned short wchar_t;所以最好就是这样:char a='0';...
答:这样写就可以了:include<stdio.h> struct worder { char * name;char * no;int year;int menoy;};int main(){ struct worder a1={"li ming","441224198612213421",6,3500};printf("\tname\tno\tyear\tmenoy\t");printf("\n");printf("\t%2s\t%2s\t%d\t%d\t",a1.name,a1...
答:你好!!将三个红圈内的 [10] 去掉,因为你的程序用不到数组 运行的结果:修改后的程序:include<iostream>#include <stdlib.h>using namespace std;int main(){int a;ints=0;int d=0;cout<<"请输入数字";cin>>a;if(a%2){s=s+a;cout<<"是偶函数"<<s;}elsed=d+a;cout<<"是偶...
答:这个函数就是返回errorno_t啊,转换后的时间在timeinfo结构里面返回。 你可以检查返回的错误代码rrorno_t err= localtime_s(&timeinfo, &nowTime);if(0 == err){ cout<
答:CFile是类,所以 CFile fileOpen = NULL; 是错误的 可以改为 CFile *fileOpen = NULL; // 如果需要的是指针 CFile fileOpen; // 如果需要的是对象
网友评论:
何虞17738721455:
C语言错误error C2440: '=' : cannot convert from 'void' to 'int'是什么问题? -
51294边盆
: 这是把void类型的值赋给int变量 当然不可以了 比如一个void函数A void A(){} int变量 x int x;x=A();就会出现
何虞17738721455:
C++ 指向函数的指针出现error2440错误 -
51294边盆
: command类中的 double (*Fcn)(double, double *); 改为 double (Funcs::*Fcn)(double, double *);
何虞17738721455:
C++代码错误求救error C2440: 'initializing' : cannot convert from 'void' to 'int' 错误行已注明 -
51294边盆
: int w=calendar(y,m); ===》 int w=date(y,m);
何虞17738721455:
出现error C2440: '=' : cannot convert from 'double' to 'double [5]'错误 -
51294边盆
: 出错报告说是赋值时发生错误,无法将整型数据转化为整型指针变量. #include using namespace std; void main() { int a[10],i,*p; cout>a[i]; p=a; for(i=1;i
何虞17738721455:
C++ error C2440 -
51294边盆
: 局部变量的内存是系统申请的,当函数结束的时候系统会自动释放函数内的局部变量的内存内存都释放了变量的值实际上是系统默认拷贝保存在寄存器中,函数退出时候局部变量是被释放了,寄存器中的值返回了回来.并不是在任何系统上都有效的,寄存器使用满了就会出现问题函数退出了,局部变量释放了,指针和引用都是指向局部变量的地址的,即便寄存器中的值存在,但是变量的地址已经不存在了,所以引用和指针肯定是无法返回的
何虞17738721455:
error C2440: '=' : cannot convert from 'int [2][2]' to 'int *' -
51294边盆
: 这个代码会报告以下错误:error C2440: '=' : cannot convert from 'int [2][2]' to 'int *' 意思是:无法把2*2的整型数组(地址)转变成整型指针. 修改成: #include<stdio.h>void main(){ int s[2][2]={1,2,3,4}; int *p; p=s[0]; printf("%d",*(p+1))...
何虞17738721455:
c语言错误 结构体 错误 1 error C2440: “初始化”: 无法从“const char [4]”转换为“char”
51294边盆
: struct good { int num; char *nam; //这儿应该是指针 char sex; };
何虞17738721455:
为什么会出现error C2440: 'initializing' : cannot convert from 'double *' to 'double **',如何解决 -
51294边盆
: double **list=new double[row];改成 double **list = new double*[row];
何虞17738721455:
c++运行下面的程序后出现 : error C2440: 'initializing' : cannot convert from 'const int' to 'int *' -
51294边盆
: int *maballs 的意思是定义一个整形指针myballs.不能指向一个直接数.你可以这样,...
何虞17738721455:
error C2440: '=' : cannot convert from 'struct LNode *' to 'int *'这句话是什么意思 -
51294边盆
: 出现这种情况的原因是,你参数赋值时,等号左右两边的参数类型不对. 根据错误描述 等号左边的参数类型是int*, 等号右边的参数类型是LNode*. 这两个肯定不能相等. 估计你是把LNode指针指针直接给了int指针,应该是LNode指针所指对象的一个参数给int指针.