I am doing a ctf problem and there is a line i can't understand.
int (*fp)(char *)=(int(*)(char *))&puts, i;
Can anyone explain me what does this mean?
fp
is a pointer
(*fp)
to a function
(*fp)(
that accepts 1 argument of type char
(*fp)(char)
and returns a value of type int
int (*fp)(char)
The pointer is initialized with the address of puts
after a mostly redundant conversion.
int (*fp)(char *)=(int(*)(char *))&puts
int (*fp)(char *)=(int(*)(char *))puts // & redundant
int (*fp)(const char *)=puts
The object i
is not initialized. It has type int
int (*fp)(char *)=(int(*)(char *))&puts, i;