Dab Tsi Yog Array

Dab Tsi Yog Array
Dab Tsi Yog Array

Video: Dab Tsi Yog Array

Video: Dab Tsi Yog Array
Video: Yog hmoov dab tsi - Gao Nou Kue ft. Mang Vang (Official Music Video) New song 2020 2024, Hlis ntuj nqeg
Anonim

Peb tuaj yeem hais nrog ib puas feem pua tseeb tias tsis muaj tus programmer uas tsis siv ib qho array hauv nws cov programs. Lawv tsis yog tsuas yog txhim kho txoj kev tsim kho lub neej, tab sis kuj ua rau nws muaj peev xwm ua cov haujlwm uas tsuas yog yam yooj yim sua kom ua tiav yam tsis muaj nws.

Dab tsi yog Array
Dab tsi yog Array

Ib qho khoom siv pob yog ib qho xaj kom khaws cov ntaub ntawv, kev xaiv ntawm tib hom, uas tau txheeb xyuas los ntawm ib lossis ntau qhov ntsuas. Thawj hom array yog qhov qub. Nws muaj nyob hauv txhua hom lus siab. Cov kev tsim tawm zoo li no tuaj yeem yog ib-seem thiab multidimensional (feem ntau lawv tsis muaj ntau tshaj 2 lossis 3 qhov ntev). Qee yam lus tsis muaj qhov tom kawg, piv txwv li ActionScript. Hauv nws, lawv tau teeb tsa los ntawm kev tsim lub npe hu ua "array ntawm arrays", i.e. tso rau hauv cov cell array tsis yog cov ntaub ntawv yooj yim (rau cov menyuam, Boolean, byte, thiab lwm yam), tab sis lwm cov qauv. Piv txwv ntawm kev tshaj tawm ib qho kev sib luag zoo li qub hauv ntau hom lus: Hauv Pascal: x: array [1..15] ntawm Qhov Sib Xws; {Ib ntu ntawm 15 yam ntawm Tus lej sib xyaw} x1: array [1..5, 1..5] ntawm Khuv Xim; {Ob-seem txheej (rooj) muaj 5 kab thiab 5 kab} Hauv C / C ++: int a [10]; // Ib qho ntev ntawm 10 ntau yam ntawm hom integer (int) ob chav b [12] [15]; // Ob kab kev faib tawm nrog 12 kab thiab 15 kab ntawm ob hom ob hom thib ob ntawm cov khoom sib txawv yog qhov hloov pauv. Hom no tuaj yeem hloov nws qhov loj thaum ua tiav kev pab cuam. Cov yam ntxwv no tuaj yeem pab tau zoo. Nws yog siv thaum nws nyuaj rau kev txiav txim siab tam sim ntawd qhov loj me los tsim qhov array. Piv txwv: Hauv Delphi: a1: Array ntawm Byte; // Ib-ntu kev ntsuas ntawm hom byte a2: Array ntawm Array ntawm char; // Multidimensional array ntawm char type Hauv C ++: ntab * arr1; // Ib-ntu ntau txoj kev rau cov menyuam ** arr2; // Multidimensional array arr1 = ntab tshiab [70]; // kev faib tawm ntawm 70 ntab block arr2 = tshiab rau cov menyuam [99]; // faib ntawm 99 pawg nrog qhov loj ntawm tus pointer rau int rau (int k = 0; k <99; k ++) arr2 [k] = tshiab rau int [17]; Cov txiaj ntsig zoo ntawm arrays - yooj yim ntawm kev txiav txim qhov chaw nyob ntawm ib qho khoom siv los ntawm ntsuas, tib lub sijhawm nkag mus rau ib qho twg thiab me me ntawm cov khoom. Txawm li cas los xij, muaj qee qhov tsis zoo nyob hauv lawv ntau hom. Piv txwv li, qhov tsis zoo ntawm ib qho kev ntsuas zoo li qub yog qhov tsis muaj qhov muaj zog, thaum ua kom muaj zog dynamic qeeb qeeb. Yog li, nws tsim nyog xaiv raws nraim hom uas zoo tshaj plaws rau kev daws cov haujlwm ntawm tes.

Pom zoo: