Chapter Contents

Previous

Next
isupper

isupper



Uppercase Alphabetic Character Test

Portability: ISO/ANSI C conforming, UNIX compatible


SYNOPSIS
DESCRIPTION
RETURN VALUE
CAUTION
EXAMPLE
RELATED FUNCTIONS
SEE ALSO


SYNOPSIS

#include <ctype.h>

int isupper(int c);


DESCRIPTION

isupper tests an integer value c to determine whether it is an uppercase alphabetic character.


RETURN VALUE

isupper returns 0 if the character is not an uppercase alphabetic character, or a nonzero value if it is. If the argument is EOF , 0 is returned.


CAUTION

The effect of isupper on a noncharacter argument other than EOF is undefined. The definition of an uppercase character is locale dependent. Do not assume that isupper returns either 0 or 1.


EXAMPLE

#include <ctype.h>
#include <stdio.h>

#define MAXLEN 40

main()
{
   char id[MAXLEN +1];
   char *text;
   char input[MAXLEN +1];
   int i;

   printf("Enter a string (maximum of %d characters):\n", MAXLEN);
   text = gets(input);

      /* Copy uppercase "identifier" from text to id.           */
   for (i = 0; i < 40 && isupper(text[i]); ++i)
      id[i] = text[i];

   id[i] = '\0';

      /* Only initial uppercase characters get copied.          */
   printf("%s\n", id);
}


RELATED FUNCTIONS

isalpha , islower , tolower , toupper


SEE ALSO


Chapter Contents

Previous

Next

Top of Page

Copyright © 2001 by SAS Institute Inc., Cary, NC, USA. All rights reserved.