how to default prototype

Discussion in 'C Programming' started by Billy Patton, Nov 7, 2003.

  1. Billy Patton

    Billy Patton Guest

    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,
     
    Billy Patton, Nov 7, 2003
    #1
    1. Advertising

  2. Billy Patton <> scribbled the following:
    > 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.

    --
    /-- Joona Palaste () ------------- Finland --------\
    \-- http://www.helsinki.fi/~palaste --------------------- rules! --------/
    "Hasta la Vista, Abie!"
    - Bart Simpson
     
    Joona I Palaste, Nov 7, 2003
    #2
    1. Advertising

  3. Greetings.

    In article <>,
    Billy Patton wrote:
    > 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,


    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

    --
    _
    _V.-o Tristan Miller [en,(fr,de,ia)] >< Space is limited
    / |`-' -=-=-=-=-=-=-=-=-=-=-=-=-=-=-= <> In a haiku, so it's hard
    (7_\\ http://www.nothingisreal.com/ >< To finish what you
     
    Tristan Miller, Nov 7, 2003
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Andy Lomax
    Replies:
    9
    Views:
    330
    Ben Pope
    Jul 2, 2005
  2. June Lee
    Replies:
    2
    Views:
    847
    Jim Cobban
    Apr 13, 2008
  3. Replies:
    9
    Views:
    234
    Thomas 'PointedEars' Lahn
    May 26, 2006
  4. Replies:
    3
    Views:
    290
  5. javascript fish
    Replies:
    0
    Views:
    196
    javascript fish
    Oct 11, 2008
Loading...

Share This Page