Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6989059
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T19:09:46+00:00 2026-05-27T19:09:46+00:00

When you do myClass.m @interface myClass { NSMutableArray *myArray; } @end @implement ….. …..

  • 0

When you do

myClass.m
@interface myClass {
   NSMutableArray   *myArray;

}
@end
@implement
.....
.....

What is the purpose when you are trying declare a variable like this.
How it looks differently when you declare

myClass.h
@import "UIKit/UIKit.h"

@interface myClass () <TableViewDataSource>
NSMutableArray *myArray

@end

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T19:09:47+00:00Added an answer on May 27, 2026 at 7:09 pm

    The first example is the declaration of an instance variable.

    The second is using a property.

    There are differences between the two. For example, when using an instance variable, you have to write your own getters/setters. With property, you do not.

    There are more differences and great detail can be found here: Declared Properties Documentation


    Updated given changes to original question.

    Assuming you’re talking about the myArray variable, in the first example, you’ve declared myArray as an instance variable of a class. To access it, you’d need to create an instance of the class.

    In the second example, you’ve declared it as a global variable which by default has file scope. That is to say, you could use it in any file which includes the myclass.h header, without the need to create an instance of the class. However, you do have to be careful about including it in multiple files, or you could end up with multiple definition errors.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hey so if I have some property like @interface MyClass { NSArray* myArray; }
I have an Objective-C class that looks something like: @interface myClass : NSObject {
In the Modern Objective-C runtime, you can do something like this: @interface MyClass :
In an interface such as this: @interface MyClass : NSObject { bool PlainOldBool; }
Consider the following code: // MyClass.h @interface MyClass @property NSInteger Value; @end //MyClass.m @implementation
I have a property defined in a class like so: @interface myClass UIImageView *drawImage[4];
i've a stupid questiona about passing pointer. I've this: @interface MyClass : NSObject myobj*
I made a class. This is the h file. // MyClass.h #import <Foundation/Foundation.h> @interface
if i have an outlet variable which i've declared as a property @interface MyClass:UIViewController
Please refer to the following code: Filename: myclass.h @interface myclass:NSObject ... @end @interface NSObject(CategoryName)

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.