Re: Pointers and arrays
Re: Pointers and arrays
- Subject: Re: Pointers and arrays
- From: "Justin C. Walker" <email@hidden>
- Date: Sun, 15 Oct 2006 16:02:35 -0700
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:
This email sent to email@hidden