QUESTIONS AND ANSWERS
Parameters of qsort - answer- Void * base, size_t nel, size_t width, int (*compar)
(const void*, const void*)) (Pointer to array, element in array, size of elements,
comparator function)
How does the comparator function work? - answer- Cast the void pointer to the type
of pointer in the given array
Assign the values of the given parameters to the pointers
Subtract a from b
If a < b, return -1
If b < a, return 1
If a == b, return 0
-o flag - answer- Produces an output file
-Wall flag - answer- Activates all warnings
-pedantic flag - answer- Produces more specific warning
-std=c99 flag - answer- Uses the c99 standard to compile
gcc - answer- Preprocessor - translate directives "#" into more C code - Use -E
Linker - connects you object code to standard (or non standard) libraries default
Compiler - converts C code into object code - Use -c
Linking Libraries - answer- Use -l(name of library) *no space
Use -L to provide a path to a library isn't in the defaults
-fPIC flag - answer- Creates a position independent code; use it when creating .o file
-shared flag - answer- Created a shared library
Name your file .so
Allows for one library to be used between multiple applications
export LD_LIBRARY_PATH=. - answer- Tells the OS the pwd of the shared library at
runtime
, Make - answer- Program to make repeated tasks easier
Makefile - answer- Name of the make program
Clean: - answer- Used to delete intermediate files
All - answer- Used to List all make commands to run by default
CC - answer- Clang or GCC
CFLAGS - answer- -Wall -std=c99 -pedantic (all flags used for linking)
Rule Format of Makefile - answer- Target: dependencies
Command
(Ensure tab space in front of the command)
Target - answer- What you want to create
Dependencies - answer- What you need to run the command (e.g .h files, .c files)
Command - answer- Any Unix command
Casting Pointers to Their Actual Type - answer- double *double_ptr_a,
*double_ptr_b;
double_ptr_a = a;
double_ptr_b = b;
Scripting languages are generally _________ instead of ________ - answer-
Interpreted, Compiled
Immediate execution allows for ________ ______________ and ________ -
answer- Rapid Development, Change
Scripting Languages have a ________ - level support for structures and libraries -
answer- High
What does python use a combination of? - answer- Python uses a combination of
compilation and interpretation
Process to Execute in Python - answer- Source code is converted into byte code
(intermediate form)
Byte code is executed by an interpreter
Improve performance versus purely interpreted systems
Compiled Execution - answer- Source -(Compiler)> Executable -(Run)> Execution
Interpreter Execution - answer- Source -(Interpreter)> Execution