Scope and Lifetime
Scope and Lifetime
function).
Scope: Inside the function at where it was defined (can’t be seen/used outside the function).
Lifetime:
Scope: Inside the function at where it was defined (can’t be seen/used outside the function).
Lifetime:
Global variable: a variable that is defined outside all the function in the file (before the main function)
Scope: Inside the file at where it was defined (can’t be seen/used outside the file without using extern).
Lifetime:
Lifetime:
Static + global variable: makes it invisible outside the file at where it was declared (can’t use extern)
Lifetime:
register + variable: tell the compiler to put the variable in the internal register inside the processor
this is done with the frequently accessed variables. Ex.: loop index may be defined as register to save the
time.
signed + variable: half the range is –ve and the other half is +ve
1- The function take (pointer to integer) and return (pointer to integer) that contains the factorial
of the input parameter. Check all the corner cases.
2- Define pulse width modulation and mention why do we need it?
3- What does Real time system means? Is it good to finish the required task in ¾ of the time
specified for the task?
4- Mention the difference between the micro controller and the micro-processor
5- Write a function that take an array of integer and the number of elements and returns the
average of the elements of the array. Check all the corner cases.
6- Write a function that multiplies two 3x3 arrays using the following equation :