C Standard Library Flashcards

(63 cards)

1
Q

What is the C address of operator used for in the scanf() function

A

To allow the scanf function to store the input in a variable

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is the return value of the C printf() function

A

The number of characters it printed

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

C Function: strlen()

A

strlen() give the length of the string passed to it

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

How do you read a string from the keyboard using the C scanf() function

A

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);

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What is the return value of the C scanf() function

A

The number of characters it successfully read

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

C Function: strcpy(string1, string2)

A

strcpy() copies the contents of string2 into string1

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

C Function: strcat(string1, string2)

A

strcat() concatenates the contents of string2 onto the end of string1

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

C Function: strcmp(string1, string2)

A

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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

C Function: fgets()

A

fgets() reads a string from the keyboard

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What is the general form of the C fgets() function

A

fgets(name, sizeof(name), stdin);

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What is the first argument in an C fgets() function call

A

The name of the character array in which to save the contents of the string

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What is the second argument in an C fgets function call

A

An integer that indicates the maximum number of characters to read, usually the size of the variable itself using the sizeof operator

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What is the third argument in an C fgets function call

A

The file from which to read, usually stdin

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

C Function: isdigit()

A

isdigit() evaluates the number passed to it and if it is a decimal digit returns true and false otherwise

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

C Function: system()

A

system() allows your programs to call commands to the system

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

C Function: islower()

A

islower() evaluates the character passed to it and if it is a lowercase letter returns true and false otherwise

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

C Function: isupper()

A

isupper() evaluates the character passed to it and if it is an uppercase letter returns true and false otherwise

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

C Function: tolower()

A

tolower() converts the character passed to it to a lowercase letter

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q

C Function: toupper()

A

toupper() converts the character passed to it to an uppercase letter

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
20
Q

C Function: exp(x)

A

exp() returns the value of x to the power of x

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
21
Q

C Function: pow(x, y)

A

pow() returns x raised to the power to y

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
22
Q

C Function: sqrt()

A

sqrt() computes the square root of the number passed to it

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
23
Q

C Function: log()

A

log() returns the natural logarithm (base e) of the number passed to it

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
24
Q

C Function: log10()

A

log10() returns the logarithm (base 10) of the number passed to it

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
25
C Function: fabs()
fabs() returns the absolute value of the number passed to it
26
C Function: ciel(x)
ciel() rounds x to the smallest integer not less than x
27
C Function: floor(x)
floor() rounds x to the largest integer not greater than x
28
C Function: fmod(x, y)
fmod() returns the remainder of x/y as a floating-point number
29
C Function: sin(x)
sin() returns the trigonometric sine of x in radians
30
C Function: cos(x)
cos() returns the trigonometric cosine of x in radians
31
C Function: tan(x)
tan() return the trigonometric tangent of x in radians
32
C Function: isalnum()
isalnum() returns true if the character passed to it is an uppercase, lowercase letter, or a decimal digit and false otherwise
33
C Function: ispunct()
ispunct() returns true if the character passed to it is a printing character that isspace() and isalnum() return false
34
C Function: isspace()
isspace() returns true if the character passed to it is a whitespace character (space, '\n', 't', 'v', 'r', 'f')
35
C Function: isblank()
isblank() returns true if the character passed to it is a standard blank character (space, 't')
36
C Function: iscntrl()
iscntrl() returns true if the character passed to it is a control character
37
C Function: isgraph()
isgraph() returns true if the character passed to it is any printing character excluding space
38
C Function: isprint()
isprint() returns true if the character passed to it is any printing character including space
39
C Function: isxdigit()
isxdigit() returns true if the character passed to it is a hexadecimal digit
40
C Function: isalpha()
isalpha() returns true if the character passed to it is an uppercase or lowercase letter
41
C Function: fflush()
fflush() clears the contents of an input or an output buffer
42
C Function: scanf()
scanf() obtains input typed in from the keyboard
43
C Function: printf()
printf() is used to print formatted output
44
C Function: rand()
rand() generates a whole number from 0 to a library-defined number
45
C Function: srand()
srand() tells the rand() function to produce a true random number every time it is executed
46
C Function: time()
time() returns the current time in seconds
47
How do you obtain values in a certain range when using the C rand() function
from 0 to integer: rand() % integer and from 1 to integer: 1 + rand() % integer
48
C Header: stdbool.h
stdbool.h makes it easier to work with boolean values
49
C Header: assert.h
assert.h includes macros and information for adding diagnostics that aid program debugging
50
C Header: ctype.h
ctype.h includes function prototypes for functions that test characters for certain properties, and function prototypes for functions that can be used to convert lowercase letters to uppercase letters and vice versa
51
C Header: errno.h
errno.h includes macros that are useful for reporting error conditions
52
C Header: float.h
float.h includes the floating-point size limits of the system
53
C Header: limits.h
limits.h includes the integral size limits of the system
54
C Header: locale.h
locale.h includes function prototypes and other information that enables a program to be modified for the current locale on which it’s running
55
C Header: setjmp.h
setjmp.h includes function prototypes for functions that allow bypassing of the usual function call and return sequence
56
C Header: signal.h
signal.h includes function prototypes and macros to handle various conditions that may arise during program execution
57
C Header: stdarg.h
stdarg.h includes macros for dealing with a list of arguments to a function whose number and types are unknown
58
C Header: stddef.h
stddef.h includes common type definitions used by C for performing calculations
59
C Header: stdlib.h
stdlib.h includes function prototypes for conversions of numbers to text and text to numbers, memory allocation, random numbers, and other utility functions
60
C Header: time.h
time.h includes function prototypes and types for manipulating the time and date
61
C Haeder: string.h
string.h includes function prototypes for string-processing functions
62
C Header: stdio.h
stdio.h contains functions for standard input/output
63
C Header: math.h
math.h contains mathematical functions