C Programming and UNIX Systems Programming

0.0(0)
Studied by 0 people
call kaiCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/54

flashcard set

Earn XP

Description and Tags

Vocabulary practice flashcards covering fundamental C programming concepts, control structures, functions, pointers, dynamic memory management, and UNIX process control mechanisms.

55 Terms

1
New cards

C Programming Language

A high-level programming language developed in 19721972 by Dennis Ritchie at AT&T Bell Laboratories, originally designed to write the UNIX operating system.

2
New cards

Preprocessor Directive

A C statement starting with the symbol ′#′'\#' (such as #\text{include} or #\text{define}) that instructs the preprocessor to modify source text or insert standard library definitions prior to compilation.

3
New cards

Constant Macro

An identifier established using a #\text{define} directive whose value is substituted throughout the source code prior to compilation and cannot be altered during program execution.

4
New cards

Reserved Words

A collection of 3232 lowercase words with predefined special meanings in C that cannot be repurposed as programmer-defined identifiers.

5
New cards

Standard Identifiers

Identifiers predefined in the C standard library (such as printf\text{printf} and scanf\text{scanf}) that perform specific operations but can technically be redefined by the programmer, though redefinition is not recommended.

6
New cards

User-Defined Identifiers

Names chosen by a programmer to designate memory cells or functions, which must consist exclusively of letters, digits, and underscores, cannot begin with a digit, and cannot match a C reserved word.

7
New cards

Top-Down Design

A problem-solving methodology that breaks down an initial complex problem into major subproblems and continues refining them until straightforward solutions can be implemented.

8
New cards
<p>Structure Chart</p>

Structure Chart

A hierarchical documentation tool that illustrates the structural relationships and decomposition among subproblems of a program.

9
New cards

Function Prototype

A declaration statement that specifies a function's name, return type, and dummy argument list to inform the compiler prior to the full function definition.

10
New cards

Formal Parameter

A variable declared in a function header and definition that accepts incoming values or addresses passed to the function during invocation.

11
New cards

Actual Argument

A value, expression, or variable passed within a function call that corresponds in position and data type to a formal parameter in the function definition.

12
New cards

Short-Circuit Evaluation

A logical evaluation technique in C where processing of an expression ceases as soon as its truth value is conclusively known (e.g., stopping when the first operand of ∣∣|| is true or the first operand of &&\&\& is false).

13
New cards

switch Statement

A multiway selection control structure in C that evaluates a controlling expression and routes execution to matching labeled casecase blocks or a defaultdefault block.

14
New cards

Counter-Controlled Loop

A repetition structure whose exact count of iterations is determined prior to loop execution using a loop control variable, an initial value, a limit, and an update step.

15
New cards

Sentinel-Controlled Loop

A repetition construct that reads data items repeatedly until an explicit end-marker value (sentinel) is supplied by the input.

16
New cards

Endfile-Controlled Loop

A loop structure that continues processing records from a stream until scanf\text{scanf} encounters an EOF\text{EOF} condition (−1-1).

17
New cards
<p>Prefix vs. Postfix Increment</p>

Prefix vs. Postfix Increment

The distinction where prefix (++i++i) increments the variable before using its value in an expression, whereas postfix (i++i++) uses the current variable value before incrementing it.

18
New cards

Array

A contiguous sequence of two or more adjacent memory cells allocated under a single identifier, where each cell has the same size and stores data of the same type.

19
New cards

Subscript-Range Error

An error that occurs when an array is referenced using an index outside its declared bounds, which typically causes a segmentation fault during execution.

20
New cards

Null Character

The escape sequence character ′\0′'\backslash 0' that terminates a valid C string and marks the end of character data inside a character array.

21
New cards

strlen

A standard string library function in <string.h>\text{<string.h>} that returns the number of characters in a string preceding the terminating null byte as a size_t\text{size\_t} value.

22
New cards

strncpy

A string copying function with the prototype char *strncpy(char *dest, const char *src, size_t n)\text{char *strncpy(char *dest, const char *src, size\_t n)} that copies at most nn characters from the source string without guaranteeing a terminating null character if the source exceeds nn bytes.

23
New cards

fgets

A line-oriented standard I/O function that safely reads at most n−1n - 1 characters from an input stream into a buffer, retaining newlines and appending a terminating null character.

24
New cards

Pointer

A variable whose value is the direct memory address of another memory location or variable.

25
New cards

Indirection

The process of referencing or modifying the contents of a memory cell via a pointer using the unary dereference operator (∗*).

26
New cards

Call by Reference

A parameter-passing mechanism in C achieved by passing variable memory addresses with the address-of operator (&\&) to pointer parameters, allowing the called function to alter the caller's variables directly.

27
New cards

Wild Pointer

An uninitialized pointer variable that points to an arbitrary or garbage memory address, risking illegal memory access when dereferenced.

28
New cards

Structure

A user-defined composite data type introduced with the structstruct keyword that aggregates one or more members of identical or disparate types under a single name.

29
New cards

Direct Component Selection Operator

The dot operator (..) placed between a structure variable and a member name to access that specific component.

30
New cards

Indirect Component Selection Operator

The arrow operator (−>->) placed between a pointer variable and a member name to dereference the structure pointer and access the specified member.

31
New cards

typedef

A C keyword used to establish type aliases or user-defined type names that represent existing standard or composite data types.

32
New cards

Self-Referential Structure

A structure type definition that includes among its members at least one pointer to an instance of the exact same structure type.

33
New cards

Union

A user-defined data structure defined with the unionunion keyword that overlays its components within the same memory location so only one member is stored at any given time.

34
New cards

Recursion

A computational programming technique where a function calls itself directly or indirectly to solve a problem by progressively reducing it to simpler subproblems.

35
New cards

Base Case

The terminating condition in a recursive algorithm for which a direct, nonrecursive answer exists, preventing infinite recursive function invocation.

36
New cards

Activation Frame

A stack frame allocated in memory for an active function call that stores parameter values, local variables, and return status.

37
New cards

Direct Recursion

A recursive pattern wherein a function's implementation contains an explicit call to the function itself.

38
New cards

Indirect Recursion

A recursive pattern wherein a function invokes a secondary function that in turn calls the initial function, forming a cyclical sequence of execution.

39
New cards

Dynamic Memory Allocation

The capability of a running C program to allocate, resize, and release memory from the system heap during execution using standard library routines.

40
New cards
<p>Program Memory Layout</p>

Program Memory Layout

The structural arrangement of a loaded binary in RAM comprising the text/code segment, initialized data segment, uninitialized data segment (BSS), heap, and stack.

41
New cards

malloc

A dynamic allocation function with the prototype void *malloc(size_t size)\text{void *malloc(size\_t size)} that reserves a contiguous block of memory of the specified byte size on the heap without zero-initializing its contents.

42
New cards

calloc

A dynamic memory function with the prototype void *calloc(size_t num, size_t size)\text{void *calloc(size\_t num, size\_t size)} that reserves memory space for an array of elements and initializes all allocated bytes to zero.

43
New cards

realloc

A dynamic memory utility with the prototype void *realloc(void *ptr, size_t size)\text{void *realloc(void *ptr, size\_t size)} that alters the size of an existing heap memory block while preserving its data contents.

44
New cards

Dangling Pointer

A pointer variable that continues to store the memory address of a block of storage that has already been released by free()\text{free()} or deallocated by falling out of scope.

45
New cards

Valgrind

An instrumentation framework and diagnostic tool suite on Linux (frequently employing Memcheck) utilized to detect dynamic memory leaks, memory corruption, and undefined variable access.

46
New cards

Process

An executing instance of a program in UNIX that possesses its own private address space, execution state, process ID, and at least one thread of control.

47
New cards

Process ID (PID)

A unique integral value assigned by the operating system to differentiate an active process from all other executing processes.

48
New cards

fork System Call

A UNIX primitive with the prototype pid_t fork(void)\text{pid\_t fork(void)} that creates a new child process by duplicating the parent's virtual address space, returning 00 to the child and the child's PID to the parent.

49
New cards

Zombie Process

A terminated UNIX process that has released its execution resources but retains a slot in the process table until its parent retrieves its exit status via a wait system call.

50
New cards

Orphan Process

A running child process whose parent has terminated prematurely, resulting in the child being inherited by a top-level system process such as init\text{init} or systemd\text{systemd}.

51
New cards

wait System Call

A UNIX system call (pid_t wait(int *stat_loc)\text{pid\_t wait(int *stat\_loc)}) that blocks the calling parent process until any one of its child processes changes state or terminates.

52
New cards

waitpid System Call

An extended UNIX process-control primitive (pid_t waitpid(pid_t pid, int *stat_loc, int options)\text{pid\_t waitpid(pid\_t pid, int *stat\_loc, int options)}) that allows waiting on a specific child PID, nonblocking execution via WNOHANG\text{WNOHANG}, or notification of stopped children.

53
New cards

WIFEXITED

A POSIX status macro that evaluates to true (nonzero) if a monitored child process terminated normally via exit\text{exit}, _exit\text{\_exit}, or a return statement from main\text{main}.

54
New cards

exec Family

A family of system calls (such as execl\text{execl}, execv\text{execv}, and execvp\text{execvp}) that overlays and completely replaces the calling process's text, data, and stack space with a new program executable image.

55
New cards

Daemon

A background UNIX process that is detached from standard terminal control and runs continuously to handle system-level maintenance or background services.