Quiz Yourself on Parameter Passing
Test your understanding of the material presented in this chapter.
Pass by value and pass by reference
1
Given the following code:
void func(int** a, int* b, int c)
{
//some code
}
int main()
{
int* a = NULL;
int b = 0;
int c = 1;
//write the correct call to func
}
What is the correct way to call func
inside main
? The first argument should be a
, the second should be b
, and the third should be c
.
A)
func(a, b, c);
B)
func(&a, &b, c);
C)
func(a, b, &c);
D)
func(a, &b, c);
Question 1 of 40 attempted
Get hands-on with 1400+ tech skills courses.