0

Which of the following function prototype is perfectly acceptable?

int Function(int Tmp = Show());

5th Nov 2018, 7:00 AM
Vaishnavi mahanteshwar patil
Vaishnavi mahanteshwar patil - avatar
4 Antworten
+ 5
@Babak The catch appears to be that show's forward declaration has to be declared before func(). You code is valid as it is. Does this pertain to Vaishnavi's original post?
5th Nov 2018, 8:22 AM
Hatsy Rei
Hatsy Rei - avatar
+ 4
But we are only given one function prototype to choose from. :x
5th Nov 2018, 7:13 AM
Hatsy Rei
Hatsy Rei - avatar
+ 4
int show(); int func(int t = show()); int main() { cout << func(); } int show() { return 10; } int func(int t) { return t + 1; } So, what do you say Hatsy Rei ? ;)
5th Nov 2018, 7:39 AM
Babak
Babak - avatar
+ 3
That's right , hatsy. I thought the missing part was the undeclared function show() which acts as a default value provider for the formal parameter of the second function. And I figured to put together a simple snippet that possibly gives a better view of the incomplete one-liner declaration. Hopefully that's what the OP's intention was about. Thanks! ;]
5th Nov 2018, 9:31 AM
Babak
Babak - avatar