www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/11/16/19:01:49

From: George Foot <mert0407 AT sable DOT ox DOT ac DOT uk>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Init string question
Date: 16 Nov 1997 21:34:53 GMT
Organization: Oxford University, England
Lines: 31
Message-ID: <64nott$2l5$1@news.ox.ac.uk>
References: <3 DOT 0 DOT 32 DOT 19971115164202 DOT 00693068 AT 195 DOT 53 DOT 80 DOT 2>
NNTP-Posting-Host: sable.ox.ac.uk
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

On Sun, 16 Nov 1997 19:34:30 GMT in comp.os.msdos.djgpp Jose Luis Perandones Colino <joepc AT writeme DOT com> wrote:

: I want a constant sting, but the string is very long, can i declare in
: multiple lines???

Of course -- you can either end each line with a backslash like this:

char *string1 = "foo\
bar";

(but you must not indent the `bar' or the indent will be part of the
string), or you can close the double-quotes and reopen them:

char *string2 = "foo"
	"bar";

In the latter case you can indent before the quotes.  You can put any
whitespace between the closing quotes and the reopening ones.

Needless to say, using either system you can split a string across as
many lines as you like.  If you're perverse, you can of course mix the
two systems...

BTW the resulting string in the above two cases is identical to "foobar".

: char text=" ... "
      ^^^
You missed out the `*', incidentally.

-- 
george DOT foot AT merton DOT oxford DOT ac DOT uk

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019