bool is_rest(string s)
{
if (strcmp(s, ""))
{
return 0;
}
else
{
return 1;
}
}
I'm having some very strange problems with the bool is_rest function. The code I have actually works and passes check50, but when I attempt to generate a song with:
./synthesize jeopardy.wav < songs/jeopardy.txt
the song it generates is 13 hours long and silent. My best guess is that somehow my function is detecting all notes as rests, but I have no idea how. Other weird things is that I was taught that 0 == False and 1 == True in bools, but this function returns an error of runtime error: load of null pointer of type 'char' Segmentation fault
if (strcmp(s, ""))
{
return 1;
}
when surely I would return 1 here if the compared strings are indeed the same?