🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.atari.st
Article #6588

Re: C question

#6588
From: Mustafa Thamer
Date: Wed, 06 Dec 1989 07:03
31 lines
1411 bytes
In article <875@lzaz.ATT.COM> hcj@lzaz.ATT.COM (HC Johnson) writes:
>NO NO NO
>you can have char *fred[] = "hello";
>or 
>char fred[] = {'h','e','l','l','o','\0'};
>but not 
>char fred[] = "hello";

Actually, K&R were not misquoted.  They say on page 84 of "The C Prorogramming
Language" (c)1978,

"Character arrays are a special case of initialization, a string may be used
instead of the braces and commas notation:
	char pattern[] = "the";
This is a shorthand for the longer but equivalent
	char pattern[] = {'t', 'h', 'e', '\0'};
... "

Evidently, the compilers are the ones who don't like it.

Did you say you were from Bell Labs, where K&R came from ...

-Mustafa Thamer



-=-

				"Two days ago I saw a vehicle that'd
				 haul that tanker.  You wanna get out
				 of here; you talk to me."
Technical Details
Message-ID: <74734@tut.cis.ohio-state.edu>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!tut.cis.ohio-state.edu!kayak.cis.ohio-state.edu!thamer
References: <8912050802.AA12717@ucbvax.Berkeley.EDU> <875@lzaz.ATT.COM>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!tut.cis.ohio-state.edu!kayak.cis.ohio-state.edu!thamer
From: thamer@kayak.cis.ohio-state.edu (Mustafa Thamer)
Newsgroups: comp.sys.atari.st
Subject: Re: C question
Message-ID: <74734@tut.cis.ohio-state.edu>
Date: 6 Dec 89 07:03:19 GMT
References: <8912050802.AA12717@ucbvax.Berkeley.EDU> <875@lzaz.ATT.COM>
Sender: news@tut.cis.ohio-state.edu
Reply-To: Mustafa Thamer <thamer@cis.ohio-state.edu>
Organization: Ohio State University Computer and Information Science
Lines: 31
Summary: No, he didn't misquote K&R