I write the part of source program code:
Typedef struct {
.
SVector dur;
.
} HMMDef;
Typedef Vector SVector;
Typedef float * Vector;//vector [1... size]
HMMDef * HMM;
HMM=node - & gt; Info. HMM;
Above is part of source program code, I have run all the source code, no problem, I want to see the HMM structure dur in specific values, look at the shape of the described the dur should be a float array,
The following is my own code
Float myf=0.0;
.
Myf=(HMM - & gt; Dur) [0];
Printf (" % f ", myf);
.
Above is my code, if you have myf=(HMM - & gt; Dur) [0]; No printf (" % f ", myf); Compile and run fine
If there is no myf=(HMM - & gt; Dur) [0]; But have a printf (" % f ", myf); Compile and run the no problem, can output 0.0
But if, both myf=(HMM - & gt; Dur) [0]; Next is the printf (" % f ", myf); Compiled through, but the runtime will interrupt, interrupt the tip is:
Unhandled exception at 0 x00418772 in HVite. Exe: 0 xc0000005: Access violation reading location 0 x00000000
Yesterday I encountered a similar problem, is to want to look at other data structures, it is the same problem, with not a printf, I thought I have a question for yesterday's structure understanding, today in a variable observation, or not, but for the structure of some variables can be output, but many can't printf variable, like this, really big, don't know what problem, is the source code where there is set up, don't let the reader read some data, C language can do this set? Some who do not understand, do to help, thank you
CodePudding user response:
Eldest brother, you is how to define the HMM, define a pointer have allocated space, the vector you don't to push_back data, the default is no data, print error, of course,CodePudding user response:
HMM is a structure pointer, myf=(HMM - & gt; Dur) [0] ok, this sentence if is empty, I think this sentence is an error, but if this sentence, printf that sentence was added to operation error, I do think, since myf can be assignment, no matter how to have a value, and is a float variable myf, don't know why to myf printf is notCodePudding user response:
1/f, said makes sense, should be (HMM - & gt; Dur) [0] this data has a problem, can debug and see whether there is data in the durCodePudding user response: