home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #30 / NN_1992_30.iso / spool / comp / lang / c / 18287 < prev    next >
Encoding:
Internet Message Format  |  1992-12-13  |  1.3 KB

  1. Path: sparky!uunet!spool.mu.edu!umn.edu!cybrspc!roy
  2. From: roy%cybrspc@cs.umn.edu (Roy M. Silvernail)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: Testing competence of potential hires
  5. Message-ID: <s04oVB3w165w@cybrspc.UUCP>
  6. Date: Sat, 12 Dec 92 18:52:15 CST
  7. References: <1g9pm5INNosg@almaak.usc.edu>
  8. Organization: Villa CyberSpace, Minneapolis, MN
  9. Lines: 26
  10.  
  11. ajayshah@almaak.usc.edu (Ajay Shah) writes:
  12.  
  13. > (trivial competence measurement)
  14. >    Consider this code fragment:
  15. >    void abc(char *cde)
  16. >    {
  17. >       for (; *cde; ++cde) *cde = toupper(*cde);
  18. >       return cde;
  19. >    }
  20. >    a) Roughly what is he trying?  (convert a string to uppercase).
  21. >    b) What errors will the (ANSI) compiler choke on?
  22. >         - it's a void and he's returning cde
  23. >       What errors will the compiler not find?
  24. >         - he is not checking if cde == NULL
  25. >    c) what header files are needed for this to compile? (string.h,ctype.h).
  26.  
  27.     d)  Assuming he changes the type to return (char *), what does he
  28.         expect to return?  (Looks like *cde == '\0' at return, to me...)
  29.  
  30.     e)  Does he suggest strupr() without asking the platform?
  31. --
  32. Roy M. Silvernail --    [my machine ] "You can't be serious!"
  33. roy%cybrspc@cs.umn.edu  [my opinions]   "Sure, I _can_...
  34. cybrspc!roy@cs.umn.edu  [my $0.0275 ]     I just choose not to be." -- me
  35.