• 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: Pointers and arrays
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Pointers and arrays


  • Subject: Re: Pointers and arrays
  • From: Joachim Deelen <email@hidden>
  • Date: Tue, 17 Oct 2006 00:06:26 +0200

Hi!

consider the following code:

int main (int argc, const char * argv[]) {
    // insert code here...
	int i[10];
	sub(i);
    return 0;
}

void sub(int *aI) {
	int i;
	for (i = 0; i < 9; i++) {
		aI[i] = i;
	}
}

I think, you will watch how the array "aI" gets filled within the function "sub(int *aI)".

Set a breakpoint at "aI[i] = i". Then in the debugger Window, where the "int *" gets displayed with the address-value of "aI", open the Context-Menu and select "View Value as...". Change "int *" to "int [10] *" an press OK (replace [10] with your array size).

Now "aI" gets displayed in a separate Window. Select the small triangles, to open the tree. After opening the second triangle, you'll see all the elements of your array!

Hope this Helps
Joachim


Am 15.10.2006 um 13:28 schrieb Michael:

May I ask this.
Using the Standard Tool.
If main() contains integer/char array i[].
If function sub_main() contains a pointer to i, how can I see the array (not the pointer) in the debugger, other than clicking on "main", in sub_main(). In other words, I wish to step through the code in sub_main and watch how the array changes.
Thanks in advance.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

_______________________________________________ Do not post admin requests to the list. They will be ignored. Xcode-users mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
  • Follow-Ups:
    • Re: Pointers and arrays
      • From: Michael <email@hidden>
References: 
 >Pointers and arrays (From: "Michael" <email@hidden>)

  • Prev by Date: Re: Re: Pointers and arrays
  • Next by Date: Re: Pointers and arrays
  • Previous by thread: Re: Pointers and arrays
  • Next by thread: Re: Pointers and arrays
  • Index(es):
    • Date
    • Thread