Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c > #23873

Re: How to passing multidimesional array of string to function?

From Eric Sosman <esosman@ieee-dot-org.invalid>
Newsgroups comp.lang.c
Subject Re: How to passing multidimesional array of string to function?
Date 2012-07-28 22:07 -0400
Organization A noiseless patient Spider
Message-ID <jv25sn$g76$1@dont-email.me> (permalink)
References <500d3b6c$0$17953$4fafbaef@reader1.news.tin.it> <31cc0ad4-4814-4735-a058-dddc4303c8c8@googlegroups.com> <jumn8h$jk1$1@dont-email.me> <jv1iq0$aci$1@speranza.aioe.org>

Show all headers | View raw


On 7/28/2012 4:41 PM, C3PO wrote:
> 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.

     If you had read (and understood) Section 6 of the FAQ,
you would have known better than to post this nonsense.

> 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).

     Wrong, both for the reasons explained in FAQ 6.* and for an
additional and altogether different reason that I don't believe
the FAQ covers.  Congratulations: You have discovered an Infrequent
fallacy!  (Hint: Is `void' the only incomplete type?)

> 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" =
> "string".
>
> Now we have:
>
> array of string
> = pointer to string
> = string
> = char *
>
> Hope that helps. It took me a while to get comfortable with this stuff.

     There can be comfort in ignorance, yes.  There's greater
utility, though, in curing your ignorance.  Read Section 6.

-- 
Eric Sosman
esosman@ieee-dot-org.invalid

Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

How to passing multidimesional array of string to function? "Alter" <no@alt.invalid> - 2012-07-23 13:53 +0200
  Re: How to passing multidimesional array of string to function? Eric Sosman <esosman@ieee-dot-org.invalid> - 2012-07-23 08:54 -0400
    Re: How to passing multidimesional array of string to function? "Alter" <no@alt.invalid> - 2012-07-24 19:08 +0200
      Re: How to passing multidimesional array of string to function? Ben Bacarisse <ben.usenet@bsb.me.uk> - 2012-07-24 18:28 +0100
        Re: How to passing multidimesional array of string to function? "Alter" <no@alt.invalid> - 2012-07-24 21:40 +0200
          Re: How to passing multidimesional array of string to function? Malcolm McLean <malcolm.mclean5@btinternet.com> - 2012-07-24 13:16 -0700
            Re: How to passing multidimesional array of string to function? Fred K <fred.l.kleinschmidt@gmail.com> - 2012-07-24 13:22 -0700
              Re: How to passing multidimesional array of string to function? Fred K <fred.l.kleinschmidt@gmail.com> - 2012-07-24 13:22 -0700
            Re: How to passing multidimesional array of string to function? Ben Bacarisse <ben.usenet@bsb.me.uk> - 2012-07-24 22:19 +0100
            Re: How to passing multidimesional array of string to function? Stephen Sprunk <stephen@sprunk.org> - 2012-07-24 19:45 -0500
          Re: How to passing multidimesional array of string to function? Ben Bacarisse <ben.usenet@bsb.me.uk> - 2012-07-24 22:07 +0100
      Re: How to passing multidimesional array of string to function? Ike Naar <ike@iceland.freeshell.org> - 2012-07-24 18:16 +0000
  Re: How to passing multidimesional array of string to function? Ben Bacarisse <ben.usenet@bsb.me.uk> - 2012-07-23 14:07 +0100
  Re: How to passing multidimesional array of string to function? Malcolm McLean <malcolm.mclean5@btinternet.com> - 2012-07-23 08:05 -0700
  Re: How to passing multidimesional array of string to function? pete <pfiland@mindspring.com> - 2012-07-23 22:51 -0400
  Re: How to passing multidimesional array of string to function? Varun Tewari <tewari.varun@gmail.com> - 2012-07-24 10:21 -0700
    Re: How to passing multidimesional array of string to function? Eric Sosman <esosman@ieee-dot-org.invalid> - 2012-07-24 13:50 -0400
      Re: How to passing multidimesional array of string to function? C3PO <nospam@nospam.com> - 2012-07-28 20:41 +0000
        Re: How to passing multidimesional array of string to function? Keith Thompson <kst-u@mib.org> - 2012-07-28 15:04 -0700
        Re: How to passing multidimesional array of string to function? Eric Sosman <esosman@ieee-dot-org.invalid> - 2012-07-28 22:07 -0400
        Re: How to passing multidimesional array of string to function? Phil Carmody <thefatphil_demunged@yahoo.co.uk> - 2012-07-29 11:33 +0300
  Re: How to passing multidimesional array of string to function? aftnix <aftnix@gmail.com> - 2012-07-26 13:35 -0700
  Re: How to passing multidimesional array of string to function? Barry Schwarz <schwarz45@yahoo.com> - 2012-07-27 15:05 -0700

csiph-web