Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is this a C variable?

Tags:

c

I was asked to explain what this C variable is: int *x();. To me, this doesn't look like a variable, but a function prototype. Am I right?

EDIT: Someone posted an answer mentioning cdecl.org as a tool to verify one's assumptions when in doubt, but now that answer has been deleted, so I'll mention it again.

like image 911
ryyst Avatar asked Jun 21 '26 10:06

ryyst


1 Answers

In C, that would be a declaration of a function returning a pointer-to-int and takes an unspecified number of arguments. The declaration of a function that takes no arguments would be int *x(void);

like image 185
dreamlax Avatar answered Jun 23 '26 12:06

dreamlax



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!