Consider the following code:
void main()
{
int i = 0;
char j[22] = "This is a long string", k[3];
scanf("%2s", k);
sprintf(j, k);
for (; i < 21; printf("%c", j[i++]));
}
It is given that the output is:
U%ae'$ffq` ong string
What could be the input?
So I think it should be something like %d
or %x
. So it executes: sprintf(j, "%x");
but there's no corresponding variable to this format.
- What does the function do in this case? It seems like an address
- What could be the input? Is it
%x
or something else?