home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / comp / lang / pascal / 7729 < prev    next >
Encoding:
Text File  |  1992-12-30  |  1.2 KB  |  33 lines

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