home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #1 / NN_1993_1.iso / spool / comp / lang / c / 19209 < prev    next >
Encoding:
Internet Message Format  |  1993-01-04  |  1.1 KB

  1. Path: sparky!uunet!zaphod.mps.ohio-state.edu!uwm.edu!ogicse!news.u.washington.edu!stein.u.washington.edu!bketcham
  2. From: bketcham@stein.u.washington.edu (Benjamin Ketcham)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: adding strings together
  5. Message-ID: <1iab6dINNsq9@shelley.u.washington.edu>
  6. Date: 4 Jan 93 21:45:49 GMT
  7. Article-I.D.: shelley.1iab6dINNsq9
  8. References: <83017@mavenry.UUCP>
  9. Organization: University of Washington, Seattle
  10. Lines: 17
  11. NNTP-Posting-Host: stein.u.washington.edu
  12.  
  13. In article <83017@mavenry.UUCP> nider@mavenry.UUCP writes:
  14. > can't you just add strings together with a +, like:
  15. > string3=string1+string2
  16. >  
  17.  
  18. Can't you just read the FAQ before posting questions like this?
  19.  
  20. It's illegal to perform addition on pointers.  Even if it was legal,
  21. the result would not be what you are probably looking for.  *string3
  22. would be garbage.  You would have to use one of the string functions
  23. available, write one yourself, or use structures.
  24.  
  25. That's one of the things I like about C.  It doesn't let you "just"
  26. add two strings together, without realizing what you are doing.
  27.  
  28. --ben
  29.