STRUCTURED PROGRAMMING Flashcards
What are 4 ways to write functions in C?
- functions with no return value
- functions with return values
- functions with no parameters
- functions with one or more parameters
- what is the size of an integer in C
- what is the size of a character in C
Integers:
32 bits -> 4 bytes
64 bits -> 8 bytes
Characters:
32bits -> 1 byte
64bits -> 1 byte
What is a variable?
It is a named location in memory, that holds a value
What is a datatype?
A datatype categorization that determines what type of values a variable can hold and what operations can be peformed on said values
What is the defrence between a call by value and a call by reference?
Both have to do with function paramenters, with call by value the function takes a value as input but performs operations on a copy of that value, hence the original value or variable is unchanged
With call by refrence the variable takes as parameter the reference of a value/variable (datatype paramname) and any operations done a permenent of the original value. any time the value is used within the fuction we write a * infront of it, indication that it is a reference
How do you calculate average marks with coeficients?
Sum of all marks multiplied by their coeficients divided by the sum of all coeficients