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


Groups > comp.lang.c > #23857

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

From C3PO <nospam@nospam.com>
Newsgroups comp.lang.c
Subject Re: How to passing multidimesional array of string to function?
Date 2012-07-28 20:41 +0000
Organization Aioe.org NNTP Server
Message-ID <jv1iq0$aci$1@speranza.aioe.org> (permalink)
References <500d3b6c$0$17953$4fafbaef@reader1.news.tin.it> <31cc0ad4-4814-4735-a058-dddc4303c8c8@googlegroups.com> <jumn8h$jk1$1@dont-email.me>

Show all headers | View raw


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" = 
"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.

Best regards,
___ C3PO ___

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