Qhov chaw nyob hauv C yog dab tsi?
Qhov chaw nyob hauv C yog dab tsi?

Video: Qhov chaw nyob hauv C yog dab tsi?

Video: Qhov chaw nyob hauv C yog dab tsi?
Video: Hnub No Mam Paub Tias Kev Npam Yog Dab Tsi. 2/22/2020 2024, Tej zaum
Anonim

Lub cim xeeb qhov chaw uas cov ntaub ntawv khaws cia yog qhov chaw nyob ntawm cov ntaub ntawv ntawd. Hauv C chaw nyob ntawm qhov sib txawv tuaj yeem tau txais los ntawm prepending tus cwj pwm & rau lub npe sib txawv. Sim cov kev pab cuam hauv qab no qhov twg a yog qhov sib txawv thiab & a yog nws chaw nyob : #include int main()

Tsis tas li ntawd, cov ntaub ntawv hom chaw nyob hauv C yog dab tsi?

Cov ntaub ntawv hauv C

Hom ntaub ntawv Memory (bytes) Format Specifier
kos npe char 1 %c
unsigned char 1 %c
ntab 4 %f
ob npaug 8 % lf

Ib sab saum toj, txhais li cas los ntawm %p hauv C? Functions teej tug mus rau tsev neeg printf muaj nuj nqi muaj hom specifiers "% p " thiab "%x" "x" thiab "X" ua rau cov lej lej hexadecimal. "x" sawv cev rau cov tsiaj ntawv qis (abcdef) thaum "X" rau cov tsiaj ntawv loj (ABCDEF). " p "servsto output a pointer. Nws yuav txawv nyob ntawm lub compiler thiab platform.

Kuj nug, qhov chaw nyob ntawm tus neeg teb xov tooj hauv C yog dab tsi?

Ib chaw nyob-tus neeg ua haujlwm yog ib tug mechanism nyob rau hauv C ++ uas rov qab lub cim xeeb chaw nyob ntawm qhov sib txawv. Cov no chaw nyob rov qab los ntawm cov chaw nyob-tus neeg ua haujlwm paub tias yog pointers, vim hais tias lawv "taw tes" mus rau qhov sib txawv ntawm lub cim xeeb. The chaw nyob-tus neeg ua haujlwm yog unary tus neeg ua haujlwm sawv cev los ntawm ampersand (&).

Dab tsi yog qhov chaw nyob thiab indirection operators hauv C?

Thaum tus pointer taw tes rau qhov sib txawv muab ib qho tsis ncaj nkag mus rau tus nqi ntawm qhov sib txawv uas khaws cia hauv nws lub cim xeeb chaw nyob , cov indirection tus neeg teb xov tooj dereferences tus pointer thiab rov qab tus nqi ntawm qhov sib txawv ntawm qhov chaw nco ntawd. Cov indirection tus neeg teb xov tooj yog unary tus neeg ua haujlwm sawv cev los ntawm lub cim (*).

Pom zoo: