Puzzle

R

Ramanathan

What is the difference between the following declarations?
void funct();
void funct(void);
I guess there is definitely a difference between them.
 
E

Emmanuel Delahaye

Ramanathan wrote on 04/09/04 :
What is the difference between the following declarations?
void funct();

This is a function declaration. It indicates the name of the function
and the return type, but nothing about the type and number of
parameters (unspecified). It's usage is not recommended.
void funct(void);

This is a detached function prototype that indicates the name of the
function, the return type, and that the function accepts no parameters
at all.

--
Emmanuel
The C-FAQ: http://www.eskimo.com/~scs/C-faq/faq.html
The C-library: http://www.dinkumware.com/refxc.html

"C is a sharp tool"
 
M

Mike Wahler

Ramanathan said:
What is the difference between the following declarations?
void funct();

Declares a function which doesn't return anything,
does not specify what parameters it has.
void funct(void);
I guess there is definitely a difference between them.

Declares a function which doesn't return anything,
specifies that it has no parameters.

Aside: In C++ the two are equivalent.

-Mike
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top