Lecture 2: Arrays Flashcards
TH 4 steps of compiling source code into machine code
1-preprocessing
2-compiling
3-assembling
4-linking
What is Preprocessing?
It looks for header files we include such as , since it contains content, like prototypes of functions that we want to include in our program
What is compiling?
ittakes our source code, in C, and converts it to another language calledassembly language
What is assembling?
it takes the code in assembly and translate it to binary or machine code byassemblingit
What is linking?
linking is the process of combining all the machine code into our one binary file
The size of each different type of data
- bool, 1 byte
- char, 1 byte
- float, 4 bytes
- int, 4 bytes
- double, 8 bytes
- long, 8 bytes
- string, ? bytes, it takes up a variable amount of space since it could be short or long.
what does an array do as a data type?
it describes multiple variables with one name. so we can store values of the same type, back-to-back, or contiguously.
Stack over flow: an array type is a data type that is meant to describe a collection of elements (values or variables), each selected by one or more indices that can be computed at run time
What are strings?
strings are just arrays of characters terminated with a null character \0
Why we need the Null character or \0?
Because it helps our program to know where the string ends. Since strings had no fixed size in memory
What are command-line arguments and what do they do?
Command-line arguments are simply arguments that are set after the name of the program
and they simply used when we tend to ask the user for input and there’s no size specified because we don’t know how big that will be
What does main function return?
it returns an integer value called anexit status which is 0 to indicate that nothing went wrong and our code has run successfully.
What happens when we write:
return 1;
and why do we write it at all?
we called a non-zero exit status which is a kind of “Handmade” error message written by the programmer itself to tell the user that they did something wrong which caused the program to exit early
What are the stages of Cryptography or what do we need to build its system?
- Plaintext: the original message, or input
- Key: additional number with the input
- Cipher: the algorithm that does the scrambling
- Ciphertext: the encrypted message, or output