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 8141807
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T12:38:08+00:00 2026-06-06T12:38:08+00:00

Have a bit of confusion here. I added a few objects from a class

  • 0

Have a bit of confusion here.

I added a few objects from a class into an array. Now I am trying to iterate through those objects and print them along with all their variables (to console).

NSArray *stockArray=[NSArray arrayWithObjects:stock1, stock2, stock3, nil];

    for (int i=0; i<4; i++)
    {
        StockHolding *stockItem=[[StockHolding alloc]init];
        stockItem=[stockArray objectAtIndex:i];
        [print stockItem];
    }

My Stock Holding class has several properties that I declare in .h and synthesize in .m along with the print method.

However, when I try to use it in the above code to print the “stockItem”, I am getting compiler error “Use of undeclared identifier ‘print'”

This doesn’t make sense since the the Stock Holding class declares print in .h and implements in .m:

-(void) print{
NSLog(@"Current purchase price is %f, current price is %f, 
number of shares are %i, cost in dollars is %f, value is dollars is %f", 
purchaseSharePrice, currentSharePrice, 
numberOfShares, self.costInDollars, self.valueInDollars);
}

Should I be using another way to print these array objects?

  • 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-06-06T12:38:10+00:00Added an answer on June 6, 2026 at 12:38 pm

    Your syntax is backwards. It should be:

    [stockItem print];
    

    Objective-C syntax goes:

    [object method];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a bit confusion in choosing whether to use NSManagedObjet class objects directly
Here, I have a bit confusion about UI language. If language is changed then
Getting into a little bit of confusion here when to use generics. I've looked
i'm having a bit of confusion with property accessors. I'd like to have an
I have a commercial product that's a DLL (native 32-bit code), and now it's
The title is a bit confusing but here's what I'm after: I have a
so I asked here few days ago about C# and its principles. Now, if
According to me, it is zero but there seems to be bit confusion here
I have a bit of confusion regarding static Combine( ) provided in System.Delegate( )
Here is what I am trying to do: When a file is requested from

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.