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


Groups > comp.lang.c > #2696

Re: length of strings in a two dimensional array

From Ben Pfaff <blp@cs.stanford.edu>
Newsgroups comp.lang.c
Subject Re: length of strings in a two dimensional array
Date 2011-04-20 10:07 -0700
Message-ID <8762q8rgvt.fsf@blp.benpfaff.org> (permalink)
References <1f5669eb-6ab6-4dd7-a9e4-486134774dc0@r4g2000prm.googlegroups.com> <bmcsq69j3rrg74953159rbrglg7kif9iu6@4ax.com> <b5f8b3cf-0463-4770-85b6-91614d4037b3@cu4g2000vbb.googlegroups.com> <iomecv$8ot$1@dont-email.me> <248e0773-734b-441d-b33b-de81217cdd46@z31g2000vbs.googlegroups.com>

Show all headers | View raw


"dr.oktopus" <blindwilly@freeonline.zzn.com> writes:

>> > Using something like:
>>
>> > #define message_lo "this is lowercase"
>> > #define message_hi "this is uppercase"
>>
>> > prevents me to use the sizeof operator, so we return at the start
>> > point.
>>
>> With the above #defines, nothing prevents you from using the expression
>> "sizeof message_lo";
>
> Is guaranteed that C will not apply that sizeof as if it would be
> a sizeof(char *)?

It's guaranteed.  A literal string has type "(unmodifiable) array
of char".  It is only converted to a pointer in the usual
contexts where arrays are converted to pointers.
-- 
Ben Pfaff 
http://benpfaff.org

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


Thread

length of strings in a two dimensional array "dr.oktopus" <blindwilly@freeonline.zzn.com> - 2011-04-19 13:54 -0700
  Re: length of strings in a two dimensional array "Morris Keesan" <mkeesan@post.harvard.edu> - 2011-04-19 17:07 -0400
  Re: length of strings in a two dimensional array Barry Schwarz <schwarzb@dqel.com> - 2011-04-19 18:34 -0700
    Re: length of strings in a two dimensional array "dr.oktopus" <blindwilly@freeonline.zzn.com> - 2011-04-20 02:09 -0700
      Re: length of strings in a two dimensional array James Kuyper <jameskuyper@verizon.net> - 2011-04-20 07:00 -0400
        Re: length of strings in a two dimensional array Ian Collins <ian-news@hotmail.com> - 2011-04-20 23:13 +1200
          Re: length of strings in a two dimensional array James Kuyper <jameskuyper@verizon.net> - 2011-04-20 07:38 -0400
            Re: length of strings in a two dimensional array "Mel Smith" <med_cutout_syntel@aol.com> - 2011-04-20 09:25 -0600
        Re: length of strings in a two dimensional array "dr.oktopus" <blindwilly@freeonline.zzn.com> - 2011-04-20 09:51 -0700
          Re: length of strings in a two dimensional array Ben Pfaff <blp@cs.stanford.edu> - 2011-04-20 10:07 -0700
          Re: length of strings in a two dimensional array James Kuyper <jameskuyper@verizon.net> - 2011-04-20 19:57 -0400
  Re: length of strings in a two dimensional array Eric Sosman <esosman@ieee-dot-org.invalid> - 2011-04-20 08:12 -0400
    Re: length of strings in a two dimensional array "dr.oktopus" <blindwilly@freeonline.zzn.com> - 2011-04-20 09:46 -0700
      Re: length of strings in a two dimensional array Peter Nilsson <airia@acay.com.au> - 2011-04-20 15:11 -0700
        Re: length of strings in a two dimensional array "dr.oktopus" <blindwilly@freeonline.zzn.com> - 2011-04-21 02:26 -0700
          Re: length of strings in a two dimensional array Eric Sosman <esosman@ieee-dot-org.invalid> - 2011-04-21 07:44 -0400
      Re: length of strings in a two dimensional array Eric Sosman <esosman@ieee-dot-org.invalid> - 2011-04-20 22:26 -0400

csiph-web