Consider the following function. void printArray(int cards[], int size) { for (int i=0; i
Consider the following function. void printArray(int cards[], int size) { for (int i=0; i
Related questions
Question
100%
Consider the following function.
void printArray(int cards[], int size)
{
for (int i=0; i<size; i++)
{
cout << cards[i] << endl;
cards[i] = 0;
}
}
It prints the array, but also sets the elements to zero, which seems like a bug for a function that should only print the array. How could we prevent this function from compiling?
A) Change i<size to i<=size
B) Change void to int
C) Insert keyword const before parameter int cards[]
D) Change for to while
Expert Solution

This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution!
Trending now
This is a popular solution!
Step by step
Solved in 2 steps

Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.