View Single Post
Old 05-25-2003, 06:48 PM   #2
KaVir
Legend
 
KaVir's Avatar
 
Join Date: Apr 2002
Name: Richard
Home MUD: God Wars II
Posts: 2,052
KaVir will become famous soon enoughKaVir will become famous soon enough
[code] void alt_caps( char *aStr )
{
  int i = 0;
  while ( aStr[i] = (i%2) ? (tolower(aStr[i])) ; (toupper(aStr[i])) )
     ++i;
}[/quote]

That assumes you're passing a pointer to a buffer which can be changed.  If not, you'll probably want to return a pointer to some memory allocated on the heap, or return a pointer to a static variable.
KaVir is offline   Reply With Quote