In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
This article is about how C language implements the creation and initialization of two-dimensional arrays. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.
Creation and initialization of two-dimensional arrays 1 creation of two-dimensional arrays int arr [3] [4]; char arr [3] [5]; double arr [2] [4]
Int arr [3] [4]
2 initialization of two-dimensional array int arr [3] [4] = {1pr 2je 3je 4}; / / if it is not fully initialized, add 0int arr [3] [4] = {{1pr 2}, {4pr 5}} / / 1 200 / / 4 500 / / 000 0int arr [] [4] = {{2jue 3}, {4pm 5}} / / if the two-dimensional array is initialized, the row can be omitted, and the column cannot be omitted. 3 the use of the two-dimensional array / / print the two-dimensional array int arr [3] [4] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12}; int I = 0; for (I = 0; I < 3; iTunes +) {int j = 0 For (j = 0; j < 4; jacks +) {printf ("% d", arr [I] [j]) }} 4 two-dimensional array storage / / print array address of each element int arr [3] [4] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12}; int I = 0; for (I = 0; I < 3; iTunes +) {int j = 0 For (j = 0; j < 4; jacks +) {printf ("& arr [% d] [% d] =% p\ n", iMagnej, & ARR [I] [j]);}}
Two-dimensional array storage seems to be discontinuous, but in fact it is continuous.
Thank you for reading! This is the end of the article on "how to create and initialize two-dimensional arrays in C language". I hope the above content can be of some help to you, so that you can learn more knowledge. If you think the article is good, you can share it for more people to see!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.