I have this statement in my Arduino code :

 byte blockcontent [16] = itoa(order);

and it gives me an error saying: "Too few arguments to function 'charitoa(int,char,int)'. Even though I've looked for the documentation of itoa function and I found that it accepts one input argument. Can anyone help me fix this error?

  • Where did you find this documentation, out of interest? The very first hit I get with Google shows 3 arguments: char * itoa ( int value, char * str, int base );
    – Nick Gammon
    Jan 13 '17 at 4:38
  • @NickGammon stackoverflow.com/a/5590395/539490
    – AJP
    Jun 16 '19 at 8:03
  • That "reference" is just a question on Stack Overflow. Underneath that question is the comment: How does option 1 even work for you at all? It's my understanding that itoa() takes three parameters - Questions are often asked because people are unsure about what they are doing.
    – Nick Gammon
    Jun 16 '19 at 10:49

itoa requires a minimum of 2 arguments.

Reference: http://www.nongnu.org/avr-libc/user-manual/group__avr__stdlib.html#gaa571de9e773dde59b0550a5ca4bd2f00

  • Thank you, but is it possible to set an array pointer instead of character pointer?
    – Raya
    Jan 12 '17 at 22:53
  • You can probably set a char pointer inside an array of char pointer yes if that is what you mean. Jan 12 '17 at 22:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.