Answer by Abhishek Bhagate for Dynamically allocated array
#include <cstdlib>#include <iostream>using namespace std;int findMin(int *arr, int n){ int mn=INT_MAX; for(int i=0;i<n;i++){ if(arr[i]<mn){ mn=arr[i]; } } return mn;};int main(){ int...
View ArticleAnswer by Yksisarvinen for Dynamically allocated array
How can I pass that array to the function?nums is already a type int*, you don't need to dereference it:findMin(nums, nums_size);why the for loop allows me to enter 4 value if my array is made up of 5...
View ArticleDynamically allocated array
I'm learning pointers in but I'm stuck on dynamic allocation of arrays.The code below provides a function to find the element with the lowest value.A dynamically allocated array is passed as a...
View Article