Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

i have doubt in VARIABLE NAME in C language????

Status
Not open for further replies.

soni.pankajkumar

Newbie level 5
Newbie level 5
Joined
Jan 10, 2006
Messages
10
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Location
Bangalore
Activity points
1,359
doubt in c language

in 'C' language we consider '_' as a Character,so can we have '_' as a first letter of any variable name,if please give me the reason???:cry:[/b]
 

zorro

Advanced Member level 4
Advanced Member level 4
Joined
Sep 6, 2001
Messages
1,130
Helped
357
Reputation
712
Reaction score
298
Trophy points
1,363
Location
Argentina
Activity points
8,909
Yes, an identifier can start with '_'.
Does the question arise because you found that a character '_' was appended at the beginning of a variable name by the compiler?
Regards

Z
 

sshahid47

Full Member level 1
Full Member level 1
Joined
Nov 5, 2004
Messages
99
Helped
15
Reputation
30
Reaction score
2
Trophy points
1,298
Activity points
974
Hi,
Yes, we can have "_" as a first character for a variable name, but usually it is advised not to do so because all the system variables have their names begining with "_" as the first character.
 

eltonjohn

Advanced Member level 4
Advanced Member level 4
Joined
Feb 22, 2002
Messages
1,435
Helped
64
Reputation
126
Reaction score
28
Trophy points
1,328
Activity points
16,329
is not a problem to use it .but once they are exported to assemble modules you will end uop with variables names with two underscores !
 

ahmad_abdulghany

Advanced Member level 4
Advanced Member level 4
Joined
Apr 12, 2005
Messages
1,206
Helped
102
Reputation
206
Reaction score
22
Trophy points
1,318
Location
San Jose, California, USA
Activity points
11,769
soni.pankajkumar said:
in 'C' language we consider '_' as a Character,so can we have '_' as a first letter of any variable name,if please give me the reason???:cry:

Can you >>> Yes you can,
Reason >>> you can guess it if you opened any header file or library file in a text document where you will find too many identifiers starts with the same char '_'
I hope that helped :)

Ahmad,
 

niket_304

Member level 4
Member level 4
Joined
Dec 21, 2005
Messages
72
Helped
3
Reputation
6
Reaction score
3
Trophy points
1,288
Activity points
2,002
yup u can use that as the first variable name but that is not advisable
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top