Question: Note: Answer in context of c++ language. 1) What is wrong with this code? int arr[] {1, 2, 3, 4, 5}; cout < < *arr;
Note: Answer in context of c++ language.
1)
What is wrong with this code?
int arr[] {1, 2, 3, 4, 5};
cout << *arr;
arr++;
2)
What is wrong with this code?
void foo (int *arr) {
int arrSize = sizeof(arr)/sizeof(arr[i]);
for (int i = 0; i < arrSize; i++) {
cout << arr[i];
}
}
3)
Given the following function header, write a function body that returns the maximum element in arr.
int findMax(int *arr, int arrSize) {
}
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
