Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Suppose that I have the following function declaration: struct x_struct my_funct

ID: 666896 • Letter: S

Question

Suppose that I have the following function declaration:

struct x_struct my_function( struct x_struct val );

While this is legal, it suffers from an inefficiency.  What is the problem?

I have no idea.  This is not the answer...

The function will execute slowly because "val", and the return value of the function will both require a lot of data copying. This is because C is call-by-value.

The function can not alter the original value of “val”, so passing it is not useful.

The function can alter the original structure “val”, making the code hard to follow.

The function will execute slowly because "val", and the return value of the function will both require a lot of data copying.  This is because C is call-by-reference.

a.

I have no idea.  This is not the answer...

b.

The function will execute slowly because "val", and the return value of the function will both require a lot of data copying. This is because C is call-by-value.

c.

The function can not alter the original value of “val”, so passing it is not useful.

d.

The function can alter the original structure “val”, making the code hard to follow.

e.

The function will execute slowly because "val", and the return value of the function will both require a lot of data copying.  This is because C is call-by-reference.

Explanation / Answer

b.

The function will execute slowly because "val", and the return value of the function will both require a lot of data copying. This is because C is call-by-value