Learn Solidity Series 4: arrays
Blog icontracy
Mar 18
Learn Solidity SeriesLearn Solidity SeriesSolidity中,有两种类型的数组:存储数组和内存数组。存储数组(Storage Arrays)这些数组被声明为状态变量,并且可以具有固定长度或动态长度。动态存储数组可以调整数组的大小,它们通过访问push()和pop()方法来调节长度。// SPDX-License-Identifier: MIT pragma solidity ^0.7.0; contract A {\ uint256\[] public numbers;// 动态长度数组\ address\[10] private users; // 固定长度数组\ uint8 users_count; function addUser(address _user) external { require(users_count < 10, "number of users is limited to 10"); users[users_count] = _user; users_count++; } function addNu...

Most popular by tracy

IQ Protocol测试操作教程——非零撸

IQ Protocol测试操作教程——非零撸

tracy

Written by
tracy
Subscribe

2025 Paragraph Technologies Inc

PopularTrendingPrivacyTermsHome
Search...Ctrl+K

tracy

Subscribe