int var(); what's happend in these code.

J

junyangzou

int var(); Someone says var is a compiler testing code????

you declared a function with a return value of int and it takes void as its parameters.
This is basically a language problem. You may want to define a variable as your name indicates, but you should omit the '()' if you are doing so only for a default initialization. Taking it away will be fine and clear.
 
S

SG

Am 12.08.2013 16:12, schrieb Mr.Zhang:
int var(); Someone says var is a compiler testing code????

I'm not sure if I understand your question, but here it goes:

int var();

declares var to be a function that takes not parameters and returns an
int. It does not declare var as int-variable. If you expected var to be
a variable then you might want to search the internet for "most vexxing
parse".
 

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

Forum statistics

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

Latest Threads

Top