Wrox Programmer Forums
|
C++ Programming General discussions for the C++ language. For questions specific to Microsoft's Visual C++ variant, see the Visual C++ forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the C++ Programming section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old April 4th, 2004, 08:58 PM
Authorized User
 
Join Date: Jun 2003
Posts: 83
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to natmaster Send a message via AIM to natmaster Send a message via MSN to natmaster
Default isset

ok, i know there's an isset() function in php to determine whether a variable has been initialized... however, i do not know if there is a similar way to check this in c.

basically, i have an array of strings using the old array of chars method, and i would like to save overhead by not initializing the entire thing, because not all of it will be potentially filled. Hoever, i do need to check whether i have set one of the elements in the array so that i stop my loop of accessing each item once i get to the end of those that i've initialized.

before i used if(arrayname[i]) //stuff
but that was causing problems, because sometimes there would be old memory taking that space and it wouldn't know that the space was not filled yet.

one of my ideas to solve this would be to make a counter to determine the last set value in the array of strings, but i would rather have a friendlier method that can actually test if it is set.

thanks in advance.

----------------------------
Aeon of Darkness MUD - Free Online Roleplaying Game
http://aeonofdarkness.com
__________________
----------------------------
Aeon of Darkness MUD - Free Online Roleplaying Game
http://aeonofdarkness.com
Reply With Quote
  #2 (permalink)  
Old April 5th, 2004, 09:18 AM
Authorized User
 
Join Date: Feb 2004
Posts: 76
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
quote:
ok, i know there's an isset() function in php to determine whether a variable has been initialized... however, i do not know if there is a similar way to check this in c.
There is not.

Dave
Reply With Quote





Similar Threads
Thread Thread Starter Forum Replies Last Post
isset($_POST) summi_beniwal Beginning PHP 1 June 21st, 2008 07:13 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.