Page 132 - Programming Microcontrollers in C
P. 132

Miscellaneous Functions     117

                          STRING OPERATIONS—Defined in string.h

                            strcat(s,t)           concatenate t to s
                            strncat(s,t,n) concatenate n characters of t to s
                            strcmp(s,t)           return negative, 0, or positive
                                                  for s< t, s==t, or s>t respectively
                            strncmp(s,t,n) compare n characters of t and s
                            strcpy(s,t)           copy t to s
                            strncpy(s,t,n) copy n characters of t to s
                            strchr(s,c)           point to the first c in s or ‘\0’
                            strrchr(s,c)          point to last c in s or ‘\0’

                          CHARACTER TESTS—in ctype.h

                            isalpha(c)          non-zero if c is alphabetic, 0 if not
                            isupper(c)          non-zero if c is uppercase, 0 if not
                            islower(c)          non-zero if c is lowercase, 0 if not
                            isdigit(c)          non-zero if c is a digit, 0 if not
                            isxdigit(c)         non-zero if c is a hexadecimal digit, 0 if not
                            isalnum(c)          non-zero if c is a digit or alphabetic, zero if not
                            isspace(c)          non-zero if c is a blank, tab, newline,
                                                return, formfeed, vertical tab, 0 if not
                            ispunct(c)          non-zero if c is a printing character except
                                                space, letter, or digit
                            iscntrl(c)          non-zero if c is a control character, 0 if not
                            isgraph(c)          non-zero if printing character except space
                            isprint(c)          non-zero if printing character including space
                            toupper(c)          return c converted to upper case
                            tolower(c)          return c converted to lower case

                          MATH FUNCTIONS—in math.h
                            sin(x)              sine of x, x in radians
                            cos(x)              cosine of x, x in radians
                            tan(x)              tangent of x, x in radians
                            asin(x)             arcsine of x, -1<=x<=1
                            acos(x)             arccosine of x, -1<=x<=1
                            atan2(x,y)          four quadrant arctan of y/x, in radians
                            atan(x)             two quadrant arctan of x, in radians
                            sinh(x)             hyperbolic sine of x
   127   128   129   130   131   132   133   134   135   136   137