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