home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.pascal
- Path: sparky!uunet!cs.utexas.edu!torn!news.ccs.queensu.ca!slip201.telnet1.QueensU.CA!dmurdoch
- From: dmurdoch@mast.queensu.ca (Duncan Murdoch)
- Subject: Re: How forgiving is TURBO pascal concerning strings?
- Message-ID: <dmurdoch.260.725724642@mast.queensu.ca>
- Lines: 21
- Sender: news@knot.ccs.queensu.ca (Netnews control)
- Organization: Queen's University
- References: <HEMSTREE.92Dec29091253@mddchh.mddchh.fc.hp.com>
- Date: Wed, 30 Dec 1992 14:10:43 GMT
-
- In article <HEMSTREE.92Dec29091253@mddchh.mddchh.fc.hp.com> hemstree@mddchh.fc.hp.com (Charles H. Hemstreet IV) writes:
- >
- >With the following brief description below what is the expected result?
- >Will Turbo pass by the comparison without an error? I am also
- >assuming that teststr[0] contains the value of the size of the string.
-
- >teststr : string[100];
- >testchar : char;
- >
- >teststr := 'the is not a big string';
- >testchar := 'a';
- >
- >if testchar = teststr[0] then make a milkshake
- >else milk the cow first
-
- There wouldn't be a syntax error on the test. Strictly speaking,
- "teststr[0]" is not the length of the string, because it's a char, not a
- number. "Ord(teststr[0])" is the length. There's no problem comparing
- chars, so you won't get any error.
-
- Duncan Murdoch
-