EE 30 Lecture 2: C Data Types and Operations

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

1/17

flashcard set

Earn XP

Description and Tags

Vocabulary flashcards covering key C programming concepts, data types, standard input/output functions, constants, and variables based on EE 30 Lecture 2.

18 Terms

1
New cards

Statements (in C)

Instructions that a computer program follows in C, where every statement must end with a semicolon ';'.

2
New cards
3
New cards

Variable

A named storage location in the computer's memory used to hold a data value that can change during program execution.

4
New cards

Declaration

The step in programming that tells the compiler a variable's name and data type so it can allocate the correct amount of memory space.

5
New cards

Initialization

The step that assigns an initial value to allocated memory space using the '=' assignment operator.

6
New cards

Constant

A variable in C that should not change during execution, declared using the 'const' keyword to make it unchangeable and read-only.

7
New cards

int

A C data type used for signed whole numbers without decimals, occupying 4 bytes4\,\text{bytes} (or 2 to 4 bytes2\text{ to }4\,\text{bytes}) of memory.

8
New cards

char

A C data type occupying 1 byte1\,\text{byte} of memory that stores a single character, letter, number, or ASCII value, and can be signed or unsigned.

9
New cards

float

A single-precision floating-point data type in C occupying 4 bytes4\,\text{bytes} of memory, sufficient for storing 6 to 76\text{ to }7 decimal digits.

10
New cards

double

A double-precision floating-point data type in C occupying 8 bytes8\,\text{bytes} of memory, sufficient for storing 1515 decimal digits.

11
New cards
<p>Floating Point Representation</p>

Floating Point Representation

A 32-bit32\text{-bit} structure comprising a 1-bit1\text{-bit} sign (SS), an 8-bit8\text{-bit} exponent, and a 23-bit23\text{-bit} significand, capable of representing numbers from 2.0×10−382.0 \times 10^{-38} to 2.0×10382.0 \times 10^{38}.

12
New cards

printf()

A standard C library function that formats data and sends it to the standard system display device (stdout/monitor).

13
New cards
<p>Format Specifier</p>

Format Specifier

A placeholder symbol starting with '%' inside printf() or scanf() functions used to output or input specific data types (such as %d for int, %f for float, %lf for double, %c for char, %s for strings).

14
New cards

scanf_s() / scanf()

A formatted input function in C that reads data from stdin according to specified format specifiers and stops reading strings at the first whitespace.

15
New cards

gets_s()

A bounds-checked, line-oriented input function in C designed to safely read an entire line of text including spaces until a newline character '\n' or EOF is encountered.

16
New cards

getchar()

A standard C input function that reads a single character from the standard input stream each time without requiring format specifiers or size parameters.

17
New cards

Address-of Operator (&)

An operator used in scanf() before non-array variable names to specify the memory address where user input should be stored.

18
New cards
<p>gets_s vs scanf_s</p>

gets_s vs scanf_s

gets_s reads a full line, stops at '\n', handles spaces, and requires no format specifier; scanf_s reads formatted input, stops at whitespace, does not handle spaces, and requires format specifiers (%s, %c, %d, etc.).