Jump to content

unitialized array defaults


dxt
 Share

Recommended Posts

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
Link to comment
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]

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...