What does the following statement mean? int(*fp)(char*) | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

What does the following statement mean? int(*fp)(char*)

I got this question in a challenge and I dont understand int (*fp)(char*); The 4 possibility to answer were: 1. function taking a char* argument and returning a pointer to int 2. Pointer to a pointer 3. Pointer to an array of chars 4. pointer to function taking a char* argument and returns an int So when I use this code cout<<*fp; I get 1 So ... after some thinking I think its either 1 or 4, but I dont know it exactly, so I'm writing this question. I need/want to know what int (*fp)(char*) means and also wich one of the questions is right

27th Mar 2017, 2:46 PM
Vodolle
Vodolle - avatar
2 Answers
+ 3
A pointer to function fp that accepts a pointer to char (open sized string) and returns an integer value. 4th one is correct.
27th Mar 2017, 3:32 PM
เคฆเฅ‡เคตเฅ‡เค‚เคฆเฅเคฐ เคฎเคนเคพเคœเคจ (Devender)
เคฆเฅ‡เคตเฅ‡เค‚เคฆเฅเคฐ เคฎเคนเคพเคœเคจ (Devender) - avatar
0
scanf("%d4s", str)
12th Sep 2021, 8:41 AM
Rohan Deodurg