Can someone explain me the syntax and logic of original 2D Array . Please, I'm so fed up of its syntax. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Can someone explain me the syntax and logic of original 2D Array . Please, I'm so fed up of its syntax.

I don't know the reason but I'm unable to understand it especially USER INPUT part.

23rd Sep 2020, 10:01 AM
Uzair
Uzair - avatar
5 Answers
+ 3
If you are asking how to take user input ,you can do something like this , int a[2][2] //declare an array of 2×2 dimensions int i,j //varaibles declaration //run a loop now for(i=0;i<=2;i++){ for(j=0;j<=2;j++){ scanf("%d",&a[i][j]); } } first outer loop will run and you will get access to first row ,then inner loop will run which will fill all the values in that particular row ,if this isn't what you want to know be more specific
23rd Sep 2020, 11:21 AM
Abhay
Abhay - avatar
0
Martin Taylor I'm asking for original array. Especially generic part.
23rd Sep 2020, 10:20 AM
Uzair
Uzair - avatar
0
Im sorry USER INPUT.
23rd Sep 2020, 10:52 AM
Uzair
Uzair - avatar
0
Abhay just add one more thing in it. And thanks for the rest of it. What if we don't know the size of array.
23rd Sep 2020, 11:28 AM
Uzair
Uzair - avatar
0
Uzair sorry don't know about how to take input for unknown array size ,and what do you mean by "just add one more thing in it"?
23rd Sep 2020, 11:38 AM
Abhay
Abhay - avatar