Array

Solidity

परिभाषा

Array एक data structure है जो same type के multiple elements को store करता है। Solidity में two types के arrays होते हैं: fixed-size arrays (compile time पर size known है) और dynamic arrays (runtime पर grow/shrink हो सकते हैं)। Arrays memory या storage में store हो सकते हैं।

English version

Array is a data structure that stores multiple elements of the same type. Solidity has two types of arrays: fixed-size arrays (size known at compile time) and dynamic arrays (can grow/shrink at runtime). Arrays can be stored in memory or storage.

Code Example

// Array de taille fixe
uint[5] public fixedArray;

// Array dynamique
uint[] public dynamicArray;

// Ajouter un élément
dynamicArray.push(42);

// Accès par index
uint first = dynamicArray[0];

// Taille
uint length = dynamicArray.length;

संबंधित शब्द

Solingo पर इस concept को practice करें

Array को interactive exercises और integrated IDE के साथ master करें।

मुफ्त में शुरू करें