Need help with c language (2-D arrays) #include <stdio.h> 1) (this is all one pr
ID: 659737 • Letter: N
Question
Need help with c language (2-D arrays)
#include <stdio.h>
1) (this is all one problem)(thank you)
Write a function that takes a 4 x 4 array of integers as its parameter. The function must use two nested for-loops to determine the largest integer in the array as well as its row and column numbers. Recall that C-functions cannot return multiple values. Use pointers in the function parameter list to relay the results to the caller program.
Write another function, which uses a 4 x 4 array of integers as its input/output parameter. The function prompts the user to enter 16 integers and stores them into 4 x 4 array.
Write the main function that uses the above function to input a 4 x 4 array and find its largest element and its row and column location. Prints the results.
Explanation / Answer
Program:
//Header files specification
#include<stdio.h>
//prototyping the function
largest=array[0][0];//finding the largest number in the array and also finding its index
for(int i=0;i<4;i++)
{
for(int j=0;j<4;j++)
{
if(array[i][j]>largest)
largest=a[i][j];
printf("%d largest number is",largest);
printf("%d,%d indexes are ",i,j);
}
//this function is making use of the above function aa given in the question.
printingsecond()
/*second function which is making use of printing function for taking input an array of 16 numbers and finding the max number inthat array along with its index*/
{
printf("this function makes use of printing finction to display 16 integers");
printing(array,4,4);//function being called in another function
}
sample output:
enter the elements
2
3
56
89
43
67
25
45
21
76
45
43
86
41
32
23
largest number is 89
indexes are 1 4