This is for a 2-d array, but if i understand how to do it for a 1-d array, I can do it for a 2-d. So to keep it simpler, I will just pretend its for a 1-d array. I am working on a project where i must enter the month number of a storm and then tell the user which month had the most storms. So I have an array and the user determines the size of it by entering the number of storms. Then, using a for loop, the user enters the month number for each storm and the data is used to fill the array. This is to be used in a part of a much larger piece of code. I made a sample code below to mimic what i want to do:
Code:
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char *argv[]) {
/*Declare variables, i is a counting index used in for loop if necessary*/
int i;
int nStorms=10;
/*Here is an array with pre-made data, where October(10) has the most storms*/
int monthArray[nStorms]= {10, 10, 9, 11, 10, 9, 6, 6, 8, 7};
/*Now, I need some commands to display back to the user "The month with the most storms is: 10"*/
system ("PAUSE");
return 0;
}
I believe this involves making some temporary array but i have no idea where to start