C 2D arrays ⬜

  Рет қаралды 107,382

Bro Code

Bro Code

Күн бұрын

Пікірлер: 49
@BroCodez
@BroCodez 3 жыл бұрын
#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; }
@doochow9962
@doochow9962 Жыл бұрын
This was so helpful! I am an IT student and was having trouble understanding 2D arrays. This is the best video I found .
@provokator-provocateur7603
@provokator-provocateur7603 3 жыл бұрын
This is better than Netflix. Im waiting every new episode.
@Programscape
@Programscape 3 жыл бұрын
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!
@javidmirza4584
@javidmirza4584 3 ай бұрын
Ну как сдал?
@numa8202
@numa8202 27 күн бұрын
thanks bro, its much easier to understand than college.
@diusepausm
@diusepausm 3 жыл бұрын
This is one of best language learning channel tutorial i know
@itchybakerzz5101
@itchybakerzz5101 3 жыл бұрын
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.
@thomasplatt7329
@thomasplatt7329 4 ай бұрын
BRO this was a game changer. seriously, thank you
@slevinshafel9395
@slevinshafel9395 2 ай бұрын
Thanks.i like how you explain it and going on details and explain where things are from or what is for, for example the first for(i) is rows and the seconds is columns(j). good job.
@JafarAlQudah
@JafarAlQudah 2 жыл бұрын
fery good fideo vro keep it in the up
@mahaveersingh-sn1eh
@mahaveersingh-sn1eh Ай бұрын
Thanks bro u cleared my doubt ❤
@republicofserbia
@republicofserbia Жыл бұрын
Thanks for helping me out. Greetings from Serbia
@AW-CODE
@AW-CODE 5 ай бұрын
great work keep it up 🤓
@celestialcamel1959
@celestialcamel1959 3 жыл бұрын
Can you make a Django course soon? Thats what I'm really waiting for!
@yigitdogan2k
@yigitdogan2k Жыл бұрын
hi, can we use: # include # define rows # define columns and then use these defined sizes in our array and loop?
@stanleywambani860
@stanleywambani860 Жыл бұрын
What my lecturer does in 2 hours you do it in 5minutes😂
@Nekochan_meoooww
@Nekochan_meoooww 12 күн бұрын
😂😂😂😂😂😂😂😂😂😂😂
@tescenmo_Ed
@tescenmo_Ed 3 жыл бұрын
Thank you ❤
@na0miiii__
@na0miiii__ 3 жыл бұрын
good vid!
@andrejpoljakovic5482
@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
@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
@GigaChad-zx9hj Жыл бұрын
@@farisraid7588 Thanks mate
@umutaydn6184
@umutaydn6184 Жыл бұрын
thanks for the video
@SHADOW-du7yf
@SHADOW-du7yf 3 жыл бұрын
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
@umachandeeswari2942
@umachandeeswari2942 2 жыл бұрын
Great!
@rmsabsal1810
@rmsabsal1810 3 ай бұрын
Can anyone explain why to get the size of column we need to specificy [0] then divide to [0][0]???
@heitor4191
@heitor4191 2 ай бұрын
This is how you can calculate the length of an array in C. First, obtain the size of the entire array (in bytes) and then divide it by the size of a single element (also in bytes). Since all elements in an array are of the same size, you can use any element to perform this calculation, and the result should always be an integer representing the total number of elements in the array. For a 2D array, to find the number of columns, you can take the array for any row (a common practice is to use the first element of the array, i.e., numbers[0]). The size of this row (or columns array) is sizeof(numbers[0]). To get the size of a single element within the columns array, use sizeof(numbers[0][0]), which refers to the first element of the first row (or the column itself). Finally, the length (or number of elements) of the columns array is sizeof(numbers[0]) / sizeof(numbers[0][0]). This should give the same length for any row in the 2D array, as each row contains the same number of columns.
@slevinshafel9395
@slevinshafel9395 2 ай бұрын
yeah i was thinking the same. and for now i am not interested on it but thanks to @heitor4191 i think i got it better.
@joeface448
@joeface448 9 ай бұрын
It took all the way up until I saw "print" to realize this wasn't C++. T_T
@DamienLawrence-z7s
@DamienLawrence-z7s 4 ай бұрын
Declaring array mentioning number of rows and columns.Why calculating number of rows and columns then? If we add an extra row or or column manually editing the code then why need to calculate number of rows and coumns on such a way?
@javenlim5514
@javenlim5514 9 ай бұрын
why does my code not run unless i add in the printf("rows: %d ", rows); printf("columns: %d ", columns);
@slevinshafel9395
@slevinshafel9395 2 ай бұрын
it runs but you cant see it. prontf is just to show you it happening. but can happen and dont show you what is done.
@magns2623
@magns2623 3 жыл бұрын
Is there is any videos about data science ???
@sachinsaagar7531
@sachinsaagar7531 3 жыл бұрын
Can u plz do the same for Android
@mrawesome7739
@mrawesome7739 Ай бұрын
Where's malloc?????
@MainulHossainAnik
@MainulHossainAnik Ай бұрын
DONE❤❤
@rendezvousonmemorylane
@rendezvousonmemorylane 3 жыл бұрын
It would be better if u spaced these out over a few days instead of uploading them all at once.
@Dovahkiin978
@Dovahkiin978 2 жыл бұрын
?
@luci1368
@luci1368 3 жыл бұрын
Bro the index of 2D arrays don't start at 0?
@javacoder2134
@javacoder2134 3 жыл бұрын
pls some java tuts?
@ADAM_SGS
@ADAM_SGS 3 жыл бұрын
Please put Arabic subtitles in KZbin settings in your videos
@Baka-mx4yc
@Baka-mx4yc 2 жыл бұрын
Allahuuu aknarrrr
@Konrado28
@Konrado28 Ай бұрын
What if he isn't Arabic and doesn't know this language?
@civicaverage796
@civicaverage796 Жыл бұрын
It wont print, and i dont know if its the shitty online compiler im using.
C array of strings🧵
2:54
Bro Code
Рет қаралды 90 М.
C pointers explained👉
8:04
Bro Code
Рет қаралды 226 М.
Every team from the Bracket Buster! Who ya got? 😏
0:53
FailArmy Shorts
Рет қаралды 13 МЛН
Thank you mommy 😊💝 #shorts
0:24
5-Minute Crafts HOUSE
Рет қаралды 33 МЛН
OCCUPIED #shortssprintbrasil
0:37
Natan por Aí
Рет қаралды 131 МЛН
Vampire SUCKS Human Energy 🧛🏻‍♂️🪫 (ft. @StevenHe )
0:34
Alan Chikin Chow
Рет қаралды 138 МЛН
All Machine Learning Models Clearly Explained!
22:23
AI For Beginners
Рет қаралды 15
C sort an array 💱
6:02
Bro Code
Рет қаралды 108 М.
C++ multidimensional arrays explained ⬜
7:41
Bro Code
Рет қаралды 20 М.
Java 2D arrays 🚚
8:06
Bro Code
Рет қаралды 200 М.
Learning C# In A Week... Otherwise I Fail University
9:04
you will never ask about pointers again after watching this video
8:03
Fast Inverse Square Root - A Quake III Algorithm
20:08
Nemean
Рет қаралды 5 МЛН
"Clean" Code, Horrible Performance
22:41
Molly Rocket
Рет қаралды 948 М.
#20 C Multidimensional Arrays | C Programming For Beginners
10:44
Every team from the Bracket Buster! Who ya got? 😏
0:53
FailArmy Shorts
Рет қаралды 13 МЛН