Re: Pointers and arrays
Re: Pointers and arrays
- Subject: Re: Pointers and arrays
- From: Rua Haszard Morris <email@hidden>
- Date: Mon, 16 Oct 2006 12:23:43 +1300
quick hasty chime in:
'View memory as..' pointer to type, i.e. int*, should do it.
?
On 16/10/2006, at 12:02 PM, Justin C. Walker wrote:
On Oct 15, 2006, at 15:52 , Michael wrote:
The compiler does this, not the debugger. In C, arrays *are*
pointers; they really aren't "first-class types".
Yes..I realize I misspoke. But, nonetheless, it still begs the
question of whether it is possible to follow an array in
"sub_function_main" when the array is initialized in "main".
All I see is a pointer to the array, even though I pass the array
to the sub_function.
I can't tell if you understand the issue yet. You are not passing
the array to the subfunction; you are passing a pointer to the
array to the subfunction. In C, non-basic types are passed by
reference, not by value. This means that all you get, in the
subfunction, is a pointer to the array 'i'. That's the language.
I don't know a way to easily get gdb to print a structured version
of an array from a pointer, but gdb is pretty flexible, so you may
be able to do it (try 'help' and follow your nose) (or hold it :-}).
Justin
--
Justin C. Walker, Curmudgeon at Large
Institute for the Absorption of Federal Funds
-----------
If it weren't for carbon-14, I wouldn't date at all.
-----------
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40adinstruments.com
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