logo codesdope

Related to pointers and arrays

   Sarthak Gupta

 ABC bank is trying to establish ATM branches in different regions of a city. There are m branches and each branch 
does a maximum of n transactions per day. The transaction could be a positive value indicating deposit, or negative 
indicating withdrawal, or zero indicating no transaction. Write a complete C program to do these tasks:
a. Read and store the transaction details of one given day for all the branches in a 2D array. First, the program 
should read values for m and n, and then read and store the transaction values in an m x n array.
b. Find and print out the maximum value of amount withdrawn on that particular day
(across all branches). Write a function (whose prototype is given below) that accomplishes this: (COLS and 
ROWS are preprocessor declared constants).
int findMaxWithdrawal(int data[][COLS], int m, int n);
c. Print the branch number (same as row number) of the branch that recorded the
maximum total amount in deposits from the data. Write and use the following function to achieve this task:
int computeMaxDeposit(int row[], int n, int *max);
While this function returns back the branch number to the calling function, it also stores the maximum value 
of the deposits using a pointer)
[Hint: This function should be repeatedly called to find out the maximum total deposits of a given row (which 
it takes as the first argument.)]

Help me in the c part of the question. Not able to understand how to pass the argumenta in that functuon as my array is 2D and their argument is 1D (row[])

 


Answers

Write your answer
Close

Welcome.please sign up.

Close

Welcome.please login.