META TOPICPARENT |
name="CourseExercises" |
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
META FILEATTACHMENT |
attachment="callMySinC.png" attr="" comment="" date="1508746212" name="callMySinC.png" path="callMySinC.png" size="14243" user="uli" version="1" |
META FILEATTACHMENT |
attachment="compileErr.png" attr="" comment="" date="1508746212" name="compileErr.png" path="compileErr.png" size="37309" user="uli" version="1" |
META FILEATTACHMENT |
attachment="Makefile.png" attr="" comment="" date="1508746212" name="Makefile.png" path="Makefile.png" size="9149" user="uli" version="1" |
META FILEATTACHMENT |
attachment="mysinC.png" attr="" comment="" date="1508746212" name="mysinC.png" path="mysinC.png" size="13854" user="uli" version="1" |
META FILEATTACHMENT |
attachment="mysinH.png" attr="" comment="" date="1508746212" name="mysinH.png" path="mysinH.png" size="2390" user="uli" version="1" |
|