Mid-course test
Functions in C
Here is a little program calling an external function. It has 3 files:
-
the main function called callMySin.c:

-
the function implementation mysin.c

-
and the include file mysin.h

When you execute the program callMySin, what does it print?
Here is how I try to compile it: What am I doing wrong?
Can you write a Makefile to compile this program correctly?
Command line parameters:
I have a program named myProg which takes 4 parameters and which I execute as follows:
./myProg uli 65 ike 35
What is the value of:
-
argc
-
argv[0]
-
argv[5]
-
(argv[3])[1]
My program needs the second and forth parameter as integer values. As we have learned, the argv[x] however are strings. What do I have to do?
Write a piece of code that makes sure that the user enters exactly 4 parameters
How can I check if the first parameter is the string “uli” and the second one the string “ike”?
Makefiles
In the following Makefile which, builds the hello world program:
which elements are
-
macros
-
targets
-
dependencies
What does $(RM) do?
What do $@ and $^ mean and, in the above Makefile example, into which values do these expand to?
--
Uli Raich - 2017-10-23
Comments
Topic revision: r2 - 2017-10-24
- uli