progweek2 Flashcards
the program starts to be executed with which function?
main()
Everytime program control encounters a function name, this function
will be _
called or invoked.
explain: The arguments are passed ”called-by-value”.
This means that each argument is evaluated, and the value is used locally for the corresponding formal parameter. The value is copied into the local variable.
If a variable is passed to a function by value, the original value of the
variable will (or will not) be changed?
not
What is scope?
It refers to the area where a function or variable is visible and
accessible to other codes.
”Identifiers are accessible only within the block in which they are
declared”
Be aware that the same identifier can be used in different declarations.
Parallel blocks are _
blocks defined at the same level.
text files:
It is a file that contains ASCII characters, used to store a stream of
characters.
key points of text files:
1
2
3
4
- Text files have no format, they are plain characters,
whitespaces and line breaks. - Each line in a text file ends with \n
- Example are files with .txt extension.
- They are a general and standard type to share information since they can be read or written by any text editor.
The basic file operations that we can perform in C are:
Creating a new file
Opening an existing file
Reading from a file
Writing to a file
Moving to a specific location in a file
Closing a file
Creating a new file;
fopen() in mode ”a”/”a+” or ”w”/”w+”
Opening an existing file;
fopen()
Reading from a file;
fscanf() or fgets()
Writing to a file;
fprintf() or fputs()
Moving to a specific location in a file;
fseek()
Closing a file;
fclose()
A file pointer is
a reference to a
particular position in the opened file.
It is used in file handling to perform all file operations.
In C, we make use of the _ macro to declare the file pointer. The
macro is already define inside the _ header file.
FILE
stdio.h
calloc and malloc in which library?
stdlib.h
CPU :
(Central Processing Unit): The brain of the computer where most calculations take place
ALU :
(Arithmetic Logic Unit): Performs arithmetic and logic operations.
Control Unit:
Directs operations within the CPU, coordinating how data moves through it.
General Registers:
Small storage locations within the CPU that hold data temporarily during execution.
Memory:
Stores data and instructions that the CPU can quickly access. It is typically volatile, meaning it loses its contents when power is turned off.
Disc:
Refers to the storage devices like hard drives or SSDs that provide non-volatile storage, meaning they retain data when powered off.
MMU :
(Memory Management Unit): A hardware component responsible for handling virtual and physical address translations.
BUS:
A communication system that transfers data between components inside a computer, or between computers.
what are the Other I/O Devices:
Monitor
Keyboard
Mouse
Printer
physical memory:
any physical support that can be
used to store data. The physical memory of modern computer is organized
in a hierarchy (from fast-small to slow-big).
Registers:
Is space that is on the CPU and
is the working memory that allows the
processor to do basic operations.