CJCoding With Joseph
15per day
← Back to Question List
C Code Walkthrough #5

Array as Function Parameter

mediumArrays

📄 Code

Read carefully — what does this print?
1#include <stdio.h>
2 
3void doubleArray(int arr[], int size) {
4 for (int i = 0; i < size; i++) {
5 arr[i] *= 2;
6 }
7}
8 
9int main() {
10 int nums[] = {1, 2, 3};
11 doubleArray(nums, 3);
12 for (int i = 0; i < 3; i++) {
13 printf("%d ", nums[i]);
14 }
15 printf("\n");
16 return 0;
17}

🎯 Your Answer