From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fc89c,97188312486d4578 X-Google-Attributes: gidfc89c,public X-Google-Thread: 109fba,baaf5f793d03d420 X-Google-Attributes: gid109fba,public X-Google-Thread: 1014db,6154de2e240de72a X-Google-Attributes: gid1014db,public X-Google-Thread: 103376,97188312486d4578 X-Google-Attributes: gid103376,public From: miker3@ix.netcom.com (Mike Rubenstein) Subject: Re: What's the best language to start with? [was: Re: Should I learn C or Pascal?] Date: 1996/08/10 Message-ID: <320bfa8b.9842502@nntp.ix.netcom.com>#1/1 X-Deja-AN: 173285431 references: <320433CE.6D5A@online.no> <4u1g29$hc0@solutions.solon.com> <01bb826a$b222f400$9bee6fce@timhome2> <4u3tt1$qub@solutions.solon.com> <4u5682$qgs@dawn.mmm.com> <4u5hcj$q3a@cnn.Princeton.EDU> organization: Netcom x-netcom-date: Fri Aug 09 10:02:27 PM CDT 1996 newsgroups: comp.lang.c,comp.lang.c++,comp.unix.programmer,comp.lang.ada Date: 1996-08-09T22:02:27-05:00 List-Id: tim@franck (Tim Hollebeek) wrote: > Any C programmer should know a string literal is a *POINTER TO* a real > object in memory. I've seen tons of bad C code based on not > understanding this. The famous 'if (x == "foo")' is just one example. This is just not true. A string literal is an array of char, not a pointer. In many situations it is converted to a pointer, but there are some where it is not. The "C programmer" who thinks a string literal is a pointer is not going to understand why #include int main(void) { char* a; a = "hello world"; if (sizeof a == sizeof "hello world") printf("no\n"); else printf("yes\n"); return 0; } probably prints yes rather than no. Michael M Rubenstein