can a function name be an identifier?

N

nomadcontauroi

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

Vladimir S. Oka

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
 
J

Jaspreet

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 ?
 
V

Vladimir S. Oka

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
 
N

nomadcontauroi

I can not express how grateful I am!
Both to your generous assistance and to your patience:)
And I am leaving.
see ya.
 
M

Michael Mair

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
 

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,755
Messages
2,569,536
Members
45,014
Latest member
BiancaFix3

Latest Threads

Top