Answer the following questions for the C language prototype shown below: signed
ID: 3819735 • Letter: A
Question
Answer the following questions for the C language prototype shown below: signed short hokum (int x, unsigned short y, signed char z); a. What is the type of return value? b. What is the type of the second argument? c. What is the function name? Write a function named smeagol that returns the product of the two passed arguments as an unsigned int. The first argument is a signed char, and the second is an unsigned short. Write a C language statement that assigns the value returned by the function defined in problem 21.2 to the variable gollum. The values passed to the function should be ring and frodo. Repeat problem 21.3 and pass literal values of 23 and 45 as arguments. What are the contents of the body of a function? What is the return statement used for? If a function does not return a value, how should the return type be declared? What should be done when calling a function that returns a value? Can the value returned from a function be passed to another function? Can multiple function calls be used in a single expression? What values can be passed as arguments to a function? How should the arguments be declared for a function that takes no arguments?Explanation / Answer
21.1)
Given function prototype
signed short hokum(int x, unsigned short y,signed char z);
a. Return type is signed short
b.Date type of second argument is unsigned short
c.The function name is hokum
21.2)
Required function with return type unsigned int
unsigned int hokum(signed char x, unsigned short y);
where first argument is signed char
and second argumet is unsigned short
21.3)
//declare a variable of type unsigned int
unsigned int gollum;
gollum=hokum(ring,frodo);
21.4)
gollum=hokum(23, 45);
21.5)
The body of the functon takes the values 23 into ring
and 45 into frodo.
21.6)
The return statement is used to return the result of the function
to the calling method.
21.7)
If a function do not return any value, void is set as return value
void means none /nothing is return from the function.
21.8)
when calling a function that returns a value, the return value
can be stored in any variable of return type or can be left.
21.9)
The value returned from a function can be passed another funcion.
21.10)
Yes multiple function calls can be made in a single expression
example, func1() +fun2()+fun3();
21.11)
Basic data types and user defined data types like struct,union can also
be passed to the function as arguments.
21.12)
The function that takes no arguments left as empty
example : void function();
The arguments list is empty means the function does
not take any argument.
If arguments need to declared , then inside the method
or global arguments can be declared.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.