Cov txheej txheem:

Muaj pes tsawg theem ntawm indirection nyob rau hauv pointers koj muaj peev xwm muaj nyob rau hauv ib qho kev tshaj tawm?
Muaj pes tsawg theem ntawm indirection nyob rau hauv pointers koj muaj peev xwm muaj nyob rau hauv ib qho kev tshaj tawm?

Video: Muaj pes tsawg theem ntawm indirection nyob rau hauv pointers koj muaj peev xwm muaj nyob rau hauv ib qho kev tshaj tawm?

Video: Muaj pes tsawg theem ntawm indirection nyob rau hauv pointers koj muaj peev xwm muaj nyob rau hauv ib qho kev tshaj tawm?
Video: txhob hnov qab kuv lub npe - Bee lee [Official MV] 2022-23 2024, Plaub Hlis Ntuj
Anonim

Koj puas tuaj yeem muaj nyob rau hauv ib qho kev tshaj tawm? cov lus teb yog "tsawg kawg 12." txhawb ntxiv. ntawm saj, tab sis muaj qhov txwv. Muaj ob qib ntawm indirection (tus pointer rau ib qho pointer rau ib yam dab tsi) yog qhov ntau.

Ntawm no, muaj pes tsawg tus taw tes sib txawv?

Muaj ob qib ntawm indirection (a taw tes rau a taw tes rau ib yam dab tsi) yog ntau. Ib qho ntau tshaj qhov ntawd tau txais me ntsis nyuaj los xav txog yooj yim; tsis txhob ua nws tshwj tsis yog tias lwm txoj kev yuav phem dua. Yog koj txhais tias " Muaj pes tsawg tus pointer indirection koj tuaj yeem muaj ntawm runtime, " muaj tsis txwv.

Ib tug kuj yuav nug, dab tsi nyob ze thiab loj pointers? Nyob ze tus taw tes yog siv los khaws 16 qhov chaw nyob txhais tau hais tias nyob rau hauv ntu tam sim no ntawm lub tshuab 16 ntsis. Qhov kev txwv yog tias peb tsuas tuaj yeem nkag tau 64kb ntawm cov ntaub ntawv ib zaug. A deb pointer feem ntau yog 32 ntsis uas tuaj yeem nkag mus rau lub cim xeeb sab nraud ntu tam sim no.

Hauv qhov no, lub luag haujlwm ntawm tus taw tes no yog dab tsi?

Qhov no taw tes yog a taw tes nkag tau tsuas yog nyob rau hauv lub nonstatic tswv cuab muaj nuj nqi ntawm ib chav kawm, struct, los yog union hom. Nws taw rau cov khoom uas tus tswv cuab muaj nuj nqi hu ua. Static member muaj nuj nqi tsis muaj qhov no taw tes.

Thaum twg peb yuav tsum siv cov pointers hauv AC program?

Cov ntsuas tau siv (hauv hom C) hauv peb txoj kev sib txawv:

  1. Txhawm rau tsim cov ntaub ntawv dynamic.
  2. Yuav kom dhau thiab tswj cov kev hloov pauv tsis tau dhau mus rau cov haujlwm.
  3. Txhawm rau nkag mus rau cov ntaub ntawv khaws cia hauv arrays. (Tshwj xeeb yog tias koj ua haujlwm nrog kev sib txuas).

Pom zoo: