Sign in to follow this  
Followers 0
dxt

unitialized array defaults

3 posts in this topic

#1 ·  Posted (edited)

Q1: What, if any, value does an uninitialized array element get and is it guaranteed?

Q2: How/can do you differentiate a value of zero (0) from the empty string ("") in a condition like (If $x = 0), for example?

Edited by dxt

Share this post


Link to post
Share on other sites



A1: the value is a 0 length string

""

A2: you would want to do this:

If $x = "0"

[size="2"] "Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it." - Brian Kernighan[/size]

Share this post


Link to post
Share on other sites

A1: the value is a 0 length string

""

A2: you would want to do this:

If $x = "0"

Thank you very much!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0