Keep getting the following warning: “too many arguments for format” for the printf function below. Do not know what is causing this warning. I provided the type values of pos and str_pos along with the printf function. I excluded all other code as I did not think it was necessary for this question.
int pos;
char str_pos;
printf("The character at index %d is %c",pos,str_pos, "\n");
The corect way of writing that printf()
statement would be
printf("The character at index %d is %c\n", pos, str_pos);
You need to change
“
to "
s. pos
and string_pos
as the argument (not part of the format string itself), in the variadic list.Also, I presume that variables are initialized before you're printing them.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.