Hi, I am a C newbie. My first project is to model my guitar (strings + frets = notes) in C and then write algorithms to create music. This post attempts a simple for loop to assign a char array containing musical letters (i.e., E, F, F#...n) to another char array of 19 possible notes on my bottom (i.e., low) E string.
Questions:Code:#include <stdio.h> main() { char e_string[19]; char notes[12] = {E, F, F#Gb, G, G#Ab, A, A#Bb, B, C, C#Db, D, D#Eb}; int i; for (i=0; i<19; i++) { e_string[i] = notes[i]; print f("%c\n", e_string[i]); } return void; }
1) Have I correctly declared and initialized my variables?
2) Have I correctly looped through i and assigned the notes to the 19 possible positions on the E string?
3) Is their a simpler way to do this operation?
Thanks for your interest and comments! IRNO



LinkBack URL
About LinkBacks



