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


Groups > comp.lang.c > #23700

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

From Stephen Sprunk <stephen@sprunk.org>
Newsgroups comp.lang.c
Subject Re: How to passing multidimesional array of string to function?
Date 2012-07-24 19:45 -0500
Organization A noiseless patient Spider
Message-ID <junfj2$br6$1@dont-email.me> (permalink)
References <500d3b6c$0$17953$4fafbaef@reader1.news.tin.it><jujhhk$g4j$1@dont-email.me><500ed69b$0$17946$4fafbaef@reader1.news.tin.it> <0.ac887cd106622944afc2.20120724182823BST.87k3xtrruw.fsf@bsb.me.uk> <500efa0c$0$17949$4fafbaef@reader1.news.tin.it> <4be38107-c496-46c5-9a9c-2c32301be1b2@googlegroups.com>

Show all headers | View raw


On 24-Jul-12 15:16, Malcolm McLean wrote:
> בתאריך יום שלישי, 24 ביולי 2012 20:40:22 UTC+1, מאת Alter:
>> I mean as an array multidimesional, a two-dimensional array.
>
> C doesn't have good syntax for two dimensional arrays.

C does have a syntax for multidimensional arrays; how "good" it may be
is purely in the eye of the beholder.  IMHO, it does an adequate job of
doing what it's designed to do.

> Its' best to treat your 2d arrays as 1d arrays, and do the
> calculation manually. array[y*width+x] will give you the element
> at y, x.

That's all the C array subscript operator does internally anyway, so you
have thrown away the syntactic sugar and type checking for no real
advantage--and increased the opportunity for bugs.

Do you propose everyone use (*ptr).field instead of ptr->field as well?

S

-- 
Stephen Sprunk         "God does not play dice."  --Albert Einstein
CCIE #3723         "God is an inveterate gambler, and He throws the
K5SSS        dice at every possible opportunity." --Stephen Hawking

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