can a function name be an identifier?

Discussion in 'C Programming' started by nomadcontauroi@hotmail.com, Jan 20, 2006.

  1. Guest

    iam wondering if a function name,say sum,could serve as an identifier?
    thanks.
    , Jan 20, 2006
    #1
    1. Advertising

  2. wrote:
    > iam wondering if a function name,say sum,could serve as an identifier?
    > thanks.
    >


    Function names _are_ idnetifiers.

    If you meant, can you reuse a function name as a variable name,
    the simple answer is no, at least not in the same scope.

    There are ways to achieve this though, but I'd strongly advise
    against them.

    Cheers

    Vladimir

    --
    My e-mail address is real, and I read it.
    Vladimir S. Oka, Jan 20, 2006
    #2
    1. Advertising

  3. writes:
    > iam wondering if a function name,say sum,could serve as an identifier?


    A function name has to be an identifier.

    What are you really trying to ask?

    --
    Keith Thompson (The_Other_Keith) <http://www.ghoti.net/~kst>
    San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
    We must do something. This is something. Therefore, we must do this.
    Keith Thompson, Jan 20, 2006
    #3
  4. Jaspreet Guest

    wrote:
    > iam wondering if a function name,say sum,could serve as an identifier?
    > thanks.


    No if you are planning to use a function name as another identifier. I
    faintly remember reading something of reusing it but my question would
    be why ? Have we run out of identifier names ?
    Jaspreet, Jan 20, 2006
    #4
  5. Guest

    Can a variable's name be identical with a function's?
    , Jan 20, 2006
    #5
  6. Guest

    iam just curious about it:)
    , Jan 20, 2006
    #6
  7. Guest

    iam just curious about it:)
    , Jan 20, 2006
    #7
  8. wrote:
    > Can a variable's name be identical with a function's?
    >


    Please quote the context you're replying to.

    Also, please phrase your questions more carefully, since the
    answer to the above question is:

    Yes /and/ No, depending on what exactly you want to achieve.

    Cheers

    Vladimir


    --
    My e-mail address is real, and I read it.
    Vladimir S. Oka, Jan 20, 2006
    #8
  9. Guest

    I can not express how grateful I am!
    Both to your generous assistance and to your patience:)
    And I am leaving.
    see ya.
    , Jan 20, 2006
    #9
  10. Michael Mair Guest

    wrote:
    > iam wondering if a function name,say sum,could serve as an identifier?


    As others have said: It is an identifier.

    The namespace and scope rules of C make the following a
    standard conforming C program; I used the identifier a
    whenever I knew it was allowed, otherwise I changed to b
    (I may have missed an opportunity for "a"):

    ,-- Do not do this at home ;-) --

    typedef struct a { union b { int a; } a; } a;

    void b (int a);

    int main (void)
    {
    a a;
    struct a { char a;} b;
    a: {
    long a;
    b: ;
    }
    return 0;
    }

    void b (int a)
    {
    int b;
    a: ;
    }

    ยด---

    Cheers
    Michael
    --
    E-Mail: Mine is an /at/ gmx /dot/ de address.
    Michael Mair, Jan 20, 2006
    #10
    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. Kobu
    Replies:
    7
    Views:
    461
  2. David T. Ashley

    Maximum Function / Variable Name Identifier Length?

    David T. Ashley, Jan 2, 2007, in forum: C Programming
    Replies:
    3
    Views:
    648
    aegis
    Jan 2, 2007
  3. Replies:
    2
    Views:
    1,771
  4. Replies:
    2
    Views:
    905
    Owen Jacobson
    Dec 11, 2007
  5. S_K
    Replies:
    0
    Views:
    662
Loading...

Share This Page