1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56
|
#include <stdio.h>
#include <stdlib.h>
#include <strings.h>
struct scale
{
char NoteNames[7][4];
char* ScaleName;
};
int main(int argc, char **argv)
{
struct scale CMaj;
struct scale CMin;
strcpy(CMaj.ScaleName,"C Major");
strcpy(&CMaj.NoteNames[0][0],"C");
strcpy(&CMaj.NoteNames[1][0],"D");
strcpy(&CMaj.NoteNames[2][0],"E");
strcpy(&CMaj.NoteNames[3][0],"F");
strcpy(&CMaj.NoteNames[4][0],"G");
strcpy(&CMaj.NoteNames[5][0],"A");
strcpy(&CMaj.NoteNames[6][0],"B");
strcpy(CMin.ScaleName,"C Minor"); //THIS LINE STOPS THE PROGRAM FROM EXECUTING
strcpy(&CMin.NoteNames[0][0],"C");
strcpy(&CMin.NoteNames[1][0],"D");
strcpy(&CMin.NoteNames[2][0],"D#");
strcpy(&CMin.NoteNames[3][0],"F");
strcpy(&CMin.NoteNames[4][0],"G");
strcpy(&CMin.NoteNames[5][0],"G#");
strcpy(&CMin.NoteNames[6][0],"A#");
// -----------------------------------------------------------------
printf("\nScale: %s\n",CMaj.ScaleName);
for(int i=0;i<7;++i)
{
printf("%s ",&CMaj.NoteNames[i][0]);
}
printf("%s\n",&CMaj.NoteNames[0][0]);
// -----------------------------------------------------------------
printf("\nScale: %s\n",CMin.ScaleName);
for(int i=0;i<7;++i)
{
printf("%s ",&CMin.NoteNames[i][0]);
}
printf("%s\n",&CMin.NoteNames[0][0]);
return 0;
}
|