Message from discussion How to passing multidimesional array of string to function?
Received: by 10.224.177.12 with SMTP id bg12mr11614452qab.0.1343789899471;
Tue, 31 Jul 2012 19:58:19 -0700 (PDT)
Received: by 10.66.72.165 with SMTP id e5mr3115892pav.4.1343789448933;
Tue, 31 Jul 2012 19:50:48 -0700 (PDT)
From: C3PO <nos...@nospam.com>
Subject: Re: How to passing multidimesional array of string to function?
Date: Sat, 28 Jul 2012 20:41:36 +0000 (UTC)
Organization: Aioe.org NNTP Server
X-Notice: Filtered by postfilter v. 0.8.2
Content-Type: text/plain; charset=UTF-8
On Tue, 24 Jul 2012 13:50:08 -0400, Eric Sosman wrote:
> On 7/24/2012 1:21 PM, Varun Tewari wrote:
>> Eventually, its a char pointer.
> No: A "multidimensional array of string" might be any of a
> few different things, but "a char pointer" is not among them.
No, Varun is correct here. C pointers can be complicated so I will
explain in some detail.
First, you must understand that arrays and pointers are really the same
thing under the hood. An array is kind of like a fixed length pointer.
So "array of X" = "pointer to X", here X can be anything (except void,
where we can have a pointer to a void type but not a void array).
Now, the string type in C is char*, e.g. pointer to char. However when
people talk of "pointer to a string" they mean "pointer to a sequence of
chars terminating in the NULL byte (\000). So "pointer to string" =
Now we have:
array of string
= pointer to string
= char *
Hope that helps. It took me a while to get comfortable with this stuff.
___ C3PO ___