C++ Functions & Related Concepts

0.0(0)
studied byStudied by 0 people
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
Card Sorting

1/41

flashcard set

Earn XP

Description and Tags

Vocabulary flashcards covering C++ functions, header files, I/O, string & math functions, parameter passing, scope, and character utilities.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

42 Terms

1
New cards

Modular Programming

A programming approach that breaks a program into smaller, manageable, reusable modules (functions); reduces code size, errors, and complexity.

2
New cards

Header File

A file containing grouped function declarations (prototypes) that can be included in programs, e.g., for math functions.

3
New cards

Function (C++)

A named unit of statements that performs a specific task; may be predefined or user-defined.

4
New cards

Predefined (Built-in) Function

A function already written, compiled, and stored in a header file, e.g., sqrt(), toupper().

5
New cards

User-Defined Function

A function written by the programmer to accomplish a specific task, e.g., main().

6
New cards

Parameter / Argument

Data supplied within the parentheses of a function call or definition that the function uses while executing.

7
New cards

cstdio

Header file that provides console character I/O functions like getchar() and putchar().

8
New cards

getchar()

Console input function that reads one character from the keyboard and returns it.

9
New cards

putchar()

Console output function that prints the character (or ASCII value) passed as its argument.

10
New cards

Stream Function

I/O function that moves a stream of bytes between memory and devices such as keyboard or monitor (e.g., get(), getline()).

11
New cards

get()

cin.get(); Input stream function that reads a single character or a string into a char array.

12
New cards

getline()

cin.getline(); Input stream function that reads a line (string) up to a delimiter, length, or Enter key.

13
New cards

put()

cout.put(); Output stream function that writes one character (or ASCII value) to standard output.

14
New cards

write()

cout.write(); Output stream function that prints a specified number of characters from a string.

15
New cards

cstring

Header file that provides C-style string manipulation functions like strcpy() and strlen().

16
New cards

strlen()

Returns the length (number of characters) of a string; return type int.

17
New cards

strcpy()

Copies one string into another: strcpy(dest, src).

18
New cards

strcat()

Appends one string to the end of another: strcat(dest, src).

19
New cards

strcmp()

Compares two strings and returns 0 if equal, negative if first < second, positive if first > second.

20
New cards

strcmpi()

Case-insensitive version of strcmp(); ignores letter case during comparison.

21
New cards

cmath

Header file that provides mathematical functions such as pow() and sqrt().

22
New cards

abs()

Returns the absolute value of an integer argument.

23
New cards

fabs()

Returns the absolute value of a floating-point argument.

24
New cards

sqrt()

Returns the square root of a number.

25
New cards

pow()

Calculates a number raised to a given power: pow(base, exponent).

26
New cards

return Statement

Sends a function's result back to the calling code and transfers control to that point.

27
New cards

void Function

A function declared with return type void; it does not return any value.

28
New cards

Actual Parameter

The real data (constants, variables, expressions) supplied in a function call.

29
New cards

Formal Parameter

Placeholder variable listed in a function definition that receives the value of an actual parameter.

30
New cards

Function Prototype

Declaration that informs the compiler about a function’s name, return type, and parameters before its use.

31
New cards

Call by Value

Parameter passing method where a copy of each actual argument is sent to the function; changes inside do not affect originals.

32
New cards

Call by Reference

Parameter passing method where the function receives references to actual arguments; changes inside affect originals.

33
New cards

Default Argument

An initial value assigned to a parameter in a function definition, allowing calls to omit that argument.

34
New cards

Scope (Lifetime)

The part of a program where a variable or function is accessible; ends when execution leaves that block or function.

35
New cards

Local Variable

Variable declared within a function/block; accessible only inside that scope.

36
New cards

Global Variable

Variable declared outside all functions; accessible throughout the entire program.

37
New cards

Local Function

Function declared inside another function; its scope is limited to the enclosing function.

38
New cards

Global Function

Function declared outside any other function; callable from anywhere in the program after its declaration.

39
New cards

isalnum()

Character function that checks whether a character is alphanumeric (letter or digit).

40
New cards

isalpha()

Character function that checks whether a character is an alphabetic letter.

41
New cards

toupper()

Converts a lowercase letter to uppercase.

42
New cards

tolower()

Converts an uppercase letter to lowercase.