Problems 1
  1. Answer the following questions:
    1. What is the main function?
    2. What is compilation and linking (of a C-program)? What is source code, object code, executable code?
    3. How do you compile and link a C-program which is wholly contained in one file, say main.c?
    4. How do you run the resulting executable code?
    5. How do you tell the compiler the description of the printf function? Why do you need to do this?
    6. How do you link the printf function?
    7. What is stdio.h?
    8. Why angle-brackets in #include<stdio.h>?
    9. Where can you get the description of the printf function (the more possibilities you name, the better)?
    10. What are the primitive data types for numbers in the C-language?
    11. Do you need to declare a variable before use in the C-language? In the Octave/MATLAB language?
    12. Can a variable hold values of different types in the C-language? In the Octave/MATLAB language?
    13. Is there any difference in how the binary operators (*,/,+,-) work in the C-language and Octave/MATLAB? For example, what is 1/2 in C and in MATLAB/Octave?
    14. How do you run an Octave script in the batch mode?
    15. How do you write to a terminal from an Octave script?
  2. Build a program that
    1. declares variables of types int, float, double, long double, double complex, long double complex;
    2. assigns some values to these variables;
    3. applies some binary operations to these variables and stores the results in new variables;
    4. prints the values of the new variables to the standard output with five decimal places using printf function.
    You might want to read the printf format string article, section format placeholders.
    Hints:
  3. Find out how many signigicant digits can variables of types float, double, and long double hold in them by trying to store the number 0.7777777777777777777777777777 in the variable and then printing out what is stored. The long double number must end with L:
    long double x = 0.7777777777777777777777777777L;
    
    otherwise it will be considered as double and truncated. Print numbers with formats placeholders "%.20g" for float, "%.20lg" for double, "%.20Lg" for long double.