Hello - first post here but I have learned so much from reading the forums here as I work on my project. So thank you in advance!
My question is with regards to the function call of itoa, like this example pulled from online:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main()
{
int a=54325;
char buffer[20];
itoa(a,buffer,2); // here 2 means binary
printf("Binary value = %s\n", buffer);
itoa(a,buffer,10); // here 10 means decimal
printf("Decimal value = %s\n", buffer);
itoa(a,buffer,16); // here 16 means Hexadecimal
printf("Hexadecimal value = %s\n", buffer);
return 0;
}
the itoa takes 3 arguments, but when in a likewise fashion, i get an error that says :
Error: C:\cvavreval\BIN\LCDproject2.c(53): too many arguments in function call
Then I referred to the stdlib.h header file, and saw the following:
void itoa(int n,char *str);
with only two arguments. In the case of only having the two arguments to work with, how can I specify if I want binary numbers or decimal numbers?
FYI ~ using avrstudio 4.19 and CodeVisionAVRv3.28
Thanks again,
Ben