Home > Back-end >  Program debugging
Program debugging

Time:03-01

# include & lt; Iostream>
# include & lt; Iomanip>//STD: : setprecision
# include & lt; Fstream>
# include & lt; Cmath>
# include & lt; String>
# include & lt; Sstream>
# include & lt; Vector>
# include & lt; Map>
# include & lt; Set>
# include & lt; Algorithm>
# include & lt; Random>
# include & lt; Chrono>
# include & lt; Time. H>
# include & lt; List>

using namespace std;

Typedef struct {
Int N, M, C;
Vector Csize;
Vector Crad.
Vector ZC.
Vector Ipads.
Vector Mdist;
Vector Nflag;

} * UserData;

# define CMax 5
Vector Cname.

Int main ()
{

The UserData data;
Data=https://bbs.csdn.net/topics/(UserData) malloc sizeof (* data);/* the Allocate data memory */
Cname. Push_back (1);
Data - & gt; N=3;
Data - & gt; M=4.
Data - & gt; C=5;
Data - & gt; Csize. Push_back (1);

Free (data);
return 0;
}

The above application in data - & gt; Csize. Push_back (1); Make a mistake, which help bosses can see reason

CodePudding user response:

Data=https://bbs.csdn.net/topics/(UserData) malloc sizeof (* data);
====& gt; To data=https://bbs.csdn.net/topics/new UserData

CodePudding user response:

After the operation showed error (activity) E0513 "UserData *" type of value can not be assigned to "UserData" types of entities

CodePudding user response:

Wrong, sorry

CodePudding user response:

Typedef struct {
Int N, M, C;
Vector Csize;
Vector Crad.
Vector ZC.
Vector Ipads.
Vector Mdist;
Vector Nflag;

} * UserData;
==="
Directly into a
Struct UserData {
Int N, M, C;
Vector Csize;
Vector Crad.
Vector ZC.
Vector Ipads.
Vector Mdist;
Vector Nflag;

};
The UserData * data=https://bbs.csdn.net/topics/new...
In c + + is a good idea to put the basic syntax is familiar with c + +

CodePudding user response:

Thank you, a success

CodePudding user response:

If you don't change the struct definition, have other remedial method
  • Related