What is the correct syntax for this code:
is it:
printf("printf(\"\%d\",%s);", some_var);
or
printf("printf(\"%%d\",%s);", some_var);
Or something else?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The second one.
%dis defined by printf, not the C language, so you need to escape it with the printf%%, not a character escape.A more complex example with a character escape sequence: