Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!wuarchive!zaphod.mps.ohio-state.edu!ncar!boulder!agcsun!jackm From: jackm@agcsun.UUCP (Jack Morrison) Newsgroups: comp.lang.c Subject: Re: Is there a good example of how toupper() works? Message-ID: <859@agcsun.UUCP> Date: 18 Oct 90 14:35:16 GMT References: <2466@ux.acs.umn.edu> <15857@csli.Stanford.EDU> Reply-To: jackm@agcsun.UUCP (Jack Morrison) Organization: Ampex VSD Golden Engineering, Golden, CO Lines: 24 >> char *duh = "Hello"; >> printf("%s\n", duh); >> while (*duh <= strlen(duh)) { >> if (islower(*duh)) *duh = toupper(*duh); >> *duh++; >> } > >(An aside: since strlen(duh) never changes, either you or the compiler >should move it outside the loop.) > Bill Even better, just use while (*duh) { if (islower(*duh)) *duh = toupper(*duh); duh++; } (or for anal types, :-) while (*duh != '\0') { -- "How am I typing? Call 1-303-279-1300" Jack C. Morrison Ampex Video Systems 581 Conference Place, Golden CO 80401