Undeclared Array...

Discussion in 'Mac Programming' started by igul222, Nov 6, 2007.

  1. igul222 macrumors newbie

    Nov 6, 2007
    Hi. I'm new to Objective-C, and programming in general (I've been writing code for all of 6 days), and I noticed that an array or string created in one method or function is unavailable to me in another:

    I'm not really surprised (from what I know, this is to be expected), but I'm still wondering how to get around the problem.

    Attached Files:

  2. SilentPanda Moderator emeritus


    Oct 8, 2002
    The Bamboo Forest
    Look in your books about local and global variables and variable scope. That should clear up your questions.
  3. hankolerd macrumors 6502


    Sep 19, 2007
    Seattle, WA
    yeah, read up on it and see what you find.
    essentially what it comes down to, is if you declare a variable inside a class and outside of functions, it can be used in any function in that class, if you declare a variable inside a function, it can be used anywhere in that function, and that function only(unless passed to a different function):apple:

Share This Page