C Standard Library Flashcards
What is the C address of operator used for in the scanf() function
To allow the scanf function to store the input in a variable
What is the return value of the C printf() function
The number of characters it printed
C Function: strlen()
strlen() give the length of the string passed to it
How do you read a string from the keyboard using the C scanf() function
Call the function with the format string containing a %s specifier and the character array you want to save the string in but don’t use the &. for example: scanf(“ %s”, array_name);
What is the return value of the C scanf() function
The number of characters it successfully read
C Function: strcpy(string1, string2)
strcpy() copies the contents of string2 into string1
C Function: strcat(string1, string2)
strcat() concatenates the contents of string2 onto the end of string1
C Function: strcmp(string1, string2)
strcmp() compares string1 and string2 and returns 0 if string1 is the same as string2 or a non-zero value if they are both different
C Function: fgets()
fgets() reads a string from the keyboard
What is the general form of the C fgets() function
fgets(name, sizeof(name), stdin);
What is the first argument in an C fgets() function call
The name of the character array in which to save the contents of the string
What is the second argument in an C fgets function call
An integer that indicates the maximum number of characters to read, usually the size of the variable itself using the sizeof operator
What is the third argument in an C fgets function call
The file from which to read, usually stdin
C Function: isdigit()
isdigit() evaluates the number passed to it and if it is a decimal digit returns true and false otherwise
C Function: system()
system() allows your programs to call commands to the system
C Function: islower()
islower() evaluates the character passed to it and if it is a lowercase letter returns true and false otherwise
C Function: isupper()
isupper() evaluates the character passed to it and if it is an uppercase letter returns true and false otherwise
C Function: tolower()
tolower() converts the character passed to it to a lowercase letter
C Function: toupper()
toupper() converts the character passed to it to an uppercase letter
C Function: exp(x)
exp() returns the value of x to the power of x
C Function: pow(x, y)
pow() returns x raised to the power to y
C Function: sqrt()
sqrt() computes the square root of the number passed to it
C Function: log()
log() returns the natural logarithm (base e) of the number passed to it
C Function: log10()
log10() returns the logarithm (base 10) of the number passed to it
C Function: fabs()
fabs() returns the absolute value of the number passed to it