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:

    callMySinC-1.png

  • the function implementation mysin.c

    mysinC-1.png

  • and the include file mysin.h

    mysinH.png

When you execute the program callMySin, what does it print?

Here is how I try to compile it: What am I doing wrong?

compileErr.png

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 \x93uli\x94 and the second one the string \x93ike\x94?

Makefiles

In the following Makefile which, builds the hello world program:

Makefile.png

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?

-- %USERSIG{UliRaich - 2017-10-23}%

Comments

 

I Attachment Action Size Date Who Comment
Makefile.pngpng Makefile.png manage 8 K 23 Oct 2017 - 08:10 UnknownUser  
callMySinC-1.pngpng callMySinC-1.png manage 14 K 24 Oct 2017 - 09:25 UnknownUser  
compileErr.pngpng compileErr.png manage 36 K 23 Oct 2017 - 08:10 UnknownUser  
mysinC-1.pngpng mysinC-1.png manage 14 K 24 Oct 2017 - 09:25 UnknownUser  
mysinH.pngpng mysinH.png manage 2 K 23 Oct 2017 - 08:10 UnknownUser  
This topic: Embedded_Systems > WebHome > CourseExercises > Test2
Topic revision: 24 Oct 2017, uli