Hi all
I'm having some problems with this code:
Code:
struct Note{
float duration;
float ampvalue;
float pitchvalue;
};
int main()
{
struct Note *gnote = malloc(sizeof(struct Note));
noteprepare(gnote, 2); /*fill *gnote with some data*/
printf("%f %f %f\n\n", gnote->duration, gnote->ampvalue, gnote->pitchvalue);
printf("%f %d %f\n\n", gnote->duration, gnote->ampvalue, gnote->pitchvalue);
return 0;
}
The only output I care about of course is from the printf() with all floats, but I can't figure out why I get weird input from the second printf().
Here is an example of what I get:
Code:
0.250000 2000.000000 587.299988
0.250000 0 26815622315368532000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000
0000000000.000000.
Or:
Code:
0.000000 2300.000000 659.260010
0.000000 0 -0.000000
The first line of output is exactly what I want, but I don't understand what's going on with the second.
Thanks for your help
PS I'll pose noteprepare() if anyone thinks it will be helpful
PPS I'm using WindowsXP with MinGW