expected primary-expression before ',' token EDIT: have solved the problem. It was missing the quotation marks around each letter. Thanks for your help, st2000!



I am very new to Arduino and C++ (coding in general!). Have copied an example code, only modifying the notes to make my own tune. But when I click 'verify', I am getting the error above, and I can't for the life of me, work out what is wrong! I've searched and read several forums and FAQs, but am just coming up blank. This is the code I have, where the error is occuring:

  int melody[]={
    a,C,D, 
    a,a,C,D,D,C, 
    C,C,D,D,C, 
    C,D,E,F,E,D,C};


Any help would be greatly appreciated!
To answer your question we will assume your project is based on the Melody example at www.arduino.cc. 

Likely you wanted to enter the ASCII values of these letters into an array of type char (type int would work as well.  But, in some cases, char would be more efficient).  To do this you need to place single quotes around each letter.  Specifically, you need to change your code: 

int melody[]={ a,C,D, a,a,C,D,D,C, C,C,D,D,C, C,D,E,F,E,D,C};


...so that your line of code look like this:

int melody[]={'a','C','D','a','a','C','D','D','C','C','C','D','D','C','C','D','E','F','E','D','C'};