Hi. I'm a total noob to C++ programming so forgive my stupid questions. Anyway, I don't quite understand arrays yet. How does one enter in data for a 2 dimensional array? input would be GREATLY appreciated...
arrays actually are a collection of data. that is u do not need to enter the data again and again. when u define an array it occupies some space in the memory. u can call them memory cells. lets see it with an example. suppose u wrote int arr1[10], that means that your variable arr1 has occupied 10 memory locations in the memory. when u enter data in the array or want to get the output from the array u use looping in order to accomplish this job of yours.
lets write a program to just accept 10 numbers entered through the array.
#include<conio.h>
#include<stdio.h>
{
main()
{
int arr[10],sum,i;
printf("Enter 10 numbers to add");
for(i=0;i<=9;i++)
scanf("%d",&arr[i]);
getch();
}
now in this program what we have done is that we have defined an array of size 10 cells. then we have run a loop to accept the input. when we run the loop we have initialised i from 0 because in c by default array locations is set to 0.
i think now might be having some concept about what array is. u will understand better if u do more and more programming. after ll pracrice makes a man perfect.