#include int main() { // 2D array = an array, where each element is an entire array // useful if you need a matrix, grid, or table of data /* int numbers[2][3] = { {1, 2, 3}, {4, 5, 6} }; */ int numbers[2][3]; int rows = sizeof(numbers)/sizeof(numbers[0]); int columns = sizeof(numbers[0])/sizeof(numbers[0][0]); printf("rows: %d ", rows); printf("columns: %d ", columns); numbers[0][0] = 1; numbers[0][1] = 2; numbers[0][2] = 3; numbers[1][0] = 4; numbers[1][1] = 5; numbers[1][2] = 6; for(int i = 0; i < rows; i++) { for(int j = 0; j < columns; j++) { printf("%d ", numbers[i][j]); } printf(" "); } return 0; }
@provokator-provocateur7603
3 жыл бұрын
This is better than Netflix. Im waiting every new episode.
@doochow9962
Жыл бұрын
This was so helpful! I am an IT student and was having trouble understanding 2D arrays. This is the best video I found .
@Programscape
2 жыл бұрын
Helllo, I'm a student from Russia and I'm learning computer sciense, I want to say you help me so much and I hope your chanell will progress much more, good luck!
@itchybakerzz5101
2 жыл бұрын
hi, I'm hoping that you can also make a compilation of this C course, just like what you did in your java tutorial. btw, thank you for these amazing tutorials.
@republicofserbia
Жыл бұрын
Thanks for helping me out. Greetings from Serbia
@AW-CODE
24 күн бұрын
great work keep it up 🤓
@diusepausm
2 жыл бұрын
This is one of best language learning channel tutorial i know
@stanleywambani860
8 ай бұрын
What my lecturer does in 2 hours you do it in 5minutes😂
@JafarAlQudah
Жыл бұрын
fery good fideo vro keep it in the up
@celestialcamel1959
2 жыл бұрын
Can you make a Django course soon? Thats what I'm really waiting for!
@yigitdogan2k
7 ай бұрын
hi, can we use: # include # define rows # define columns and then use these defined sizes in our array and loop?
@javenlim5514
5 ай бұрын
why does my code not run unless i add in the printf("rows: %d ", rows); printf("columns: %d ", columns);
@na0miiii__
2 жыл бұрын
good vid!
@tescenmo_Ed
2 жыл бұрын
Thank you ❤
@joeface448
4 ай бұрын
It took all the way up until I saw "print" to realize this wasn't C++. T_T
@andrejpoljakovic5482
2 жыл бұрын
Hi! Great video! I have a question. How does the code change from this if I need for a user to input the size of rows and columns,and not be given like in this video? Any help would be great,tnx! :)
@farisraid7588
Жыл бұрын
#include int main() { int rows, columns; printf("Enter the number of rows: "); scanf("%d", &rows); printf("Enter the number of columns: "); scanf("%d", &columns); int numbers[rows][columns]; for (int i = 0; i < rows; i++) { for (int j = 0; j < columns; j++) { printf("Enter the value for element [%d][%d]: ", i, j); scanf("%d", &numbers[i][j]); } } printf(" "); for (int i = 0; i < rows; i++) { for (int j = 0; j < columns; j++) { printf("%d ", numbers[i][j]); } printf(" "); } return 0; } In this example, we first declare the rows and columns variables, and then use scanf() to read in the values from the user. We then declare the numbers array using the values of rows and columns. Next, we use two nested loops to iterate over each element of the array and prompt the user to enter the value for that element using scanf(). Finally, we print out the entire array using two nested loops and the printf() function.
@GigaChad-zx9hj
Жыл бұрын
@@farisraid7588 Thanks mate
@umutaydn6184
Жыл бұрын
thanks for the video
@umachandeeswari2942
2 жыл бұрын
Great!
@SHADOW-du7yf
2 жыл бұрын
Can you create a tutorial on how to create a website. Like what program to use and what languages you need to know .Would be a great video
@sachinsaagar7531
2 жыл бұрын
Can u plz do the same for Android
@magns2623
2 жыл бұрын
Is there is any videos about data science ???
@luci1368
2 жыл бұрын
Bro the index of 2D arrays don't start at 0?
@rendezvousonmemorylane
2 жыл бұрын
It would be better if u spaced these out over a few days instead of uploading them all at once.
@Dovahkiin978
Жыл бұрын
?
@javacoder2134
2 жыл бұрын
pls some java tuts?
@ADAM_SGS
2 жыл бұрын
Please put Arabic subtitles in KZitem settings in your videos
@Baka-mx4yc
2 жыл бұрын
Allahuuu aknarrrr
@civicaverage796
10 ай бұрын
It wont print, and i dont know if its the shitty online compiler im using.
Пікірлер: 34