• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Struggling with basics of Objective C
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Struggling with basics of Objective C


  • Subject: Re: Struggling with basics of Objective C
  • From: Ed Baskerville <email@hidden>
  • Date: Sun, 6 Mar 2005 13:00:25 -0800

It looks like you're mixing up NSNumber objects (which cannot have arithmetic operations done on them the way you're trying to do them) with simple int variables.

But before I try to answer your question fully: can you send the rest of the code for this method, including variable declarations, so we can be sure of exactly what's going on?

FYI: if a C array (or anything else from C) seems better for your purpose, there's no problem using them in Objective-C. It's a strict superset of C.

--Ed

On Mar 6, 2005, at 12:47 PM, John Hopkins wrote:

Hi Im new to all this and have had a few successes in making my programming do what I want it to do. Yet I am struggling with some of the basic stuff. ANSI C for example I can add two integers together quite simply. However in OBjC when I recall two integers from an array and assign them to a variable I keep getting the following warning message: assignment makes pointer from integer without a cast. What does it mean? How do I make it right? Please forgive my dimness I'm quite new to all this.

inputArray = [[NSMutableArray alloc] initWithCapacity:7];

	x = [[sender selectedCell] tag];
	[inputArray insertObject:[NSNumber numberWithInt:x] atIndex:0];

num1 = [inputArray objectAtIndex:0];
num2 = [inputArray objectAtIndex:1];
answer = num1 + num2;

John _______________________________________________

_______________________________________________ Do not post admin requests to the list. They will be ignored. Cocoa-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
References: 
 >Struggling with basics of Objective C (From: John Hopkins <email@hidden>)

  • Prev by Date: Struggling with basics of Objective C
  • Next by Date: iTunes Music Library parsing help
  • Previous by thread: Struggling with basics of Objective C
  • Next by thread: Re: Struggling with basics of Objective C
  • Index(es):
    • Date
    • Thread