how to default prototype

B

Billy Patton

Not sure if the description is correct.
I want to do something like:

char* x(int x=3);
int main(void) { printf("something = '%s'\n",x()); }

char* x(int x) { return (x==3)?"3":"1";}


From my limited use of c++ I know this is possible in c++.

Is this possible in c. I'm unable to use c++ and must use c.

please respond via email instead of posting to this news group.

___ _ ____ ___ __ __
/ _ )(_) / /_ __ / _ \___ _/ /_/ /____ ___
/ _ / / / / // / / ___/ _ `/ __/ __/ _ \/ _ \
/____/_/_/_/\_, / /_/ \_,_/\__/\__/\___/_//_/
/___/
Texas Instruments ASIC Circuit Design Methodlogy Group
Dallas, Texas, 214-480-4455, (e-mail address removed)
 
J

Joona I Palaste

Billy Patton said:
Not sure if the description is correct.
I want to do something like:
char* x(int x=3);
int main(void) { printf("something = '%s'\n",x()); }
char* x(int x) { return (x==3)?"3":"1";}

From my limited use of c++ I know this is possible in c++.
Yes.

Is this possible in c. I'm unable to use c++ and must use c.
No.

please respond via email instead of posting to this news group.

No.
 
T

Tristan Miller

Greetings.

char* x(int x=3);
int main(void) { printf("something = '%s'\n",x()); }

Is this possible in c.
Nope.

please respond via email instead of posting to this news group.

Read here, post here.
___ _ ____ ___ __ __
/ _ )(_) / /_ __ / _ \___ _/ /_/ /____ ___
/ _ / / / / // / / ___/ _ `/ __/ __/ _ \/ _ \
/____/_/_/_/\_, / /_/ \_,_/\__/\__/\___/_//_/
/___/
Texas Instruments ASIC Circuit Design Methodlogy Group
Dallas, Texas, 214-480-4455, (e-mail address removed)

Please consider trimming your signature -- seven lines is a bit much.
You're also lacking the standard separator (a line containing only two
hyphens followed by a space).

Regards,
Tristan
 

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

Similar Threads


Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,053
Latest member
BrodieSola

Latest Threads

Top