{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

08chuoi ki tu - Bi u di n trong b nh Nh c l i Cc trong b nh...

Info icon This preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
1 Chu i kí t [email protected] ch Bi u di n trong b nh Nh c l i: – Các ô trong b nh ớñượ c ñ ánh ñị a ch – Môt khai báo bi ế n cho phép dành m t “ô” ñể ch a giá tr Ví d : char ch; ch = ‘B’; 0x1FFF 0x2000 0x2001 0x2002 0x1FFE etc ‘B’ Bi u di n chu i kí t • M t chu i ñượ c bi u di n b i m t m ng kí t • M i ph n t c a m ng ch a m t char • Tên chu i là ñị a ch tr ỏñế n ph n t ửñầ u tiên c a m ng Ví d : char name[5]; 0x2000 0x2004 name = 0x2000 M ng kí t vs. Chu i kí t • M t chu i kí t là m t m ng kí t nh ư ng không ph i là ñ i u ng ượ c l i • M t chu i kí t ph i có kí t k ế t thúc hay còn g i là kí t r ng ( ’\0’ ) • Kí t k ế t thúc dùng ñể báo hi u ñ i m d ng c a xâu. Nó ti n cho vi c x lí xâu trong các hàm, ví d nh ư hàm printf(), scanf(), v.v. Khai báo chu i Khai báo 1: char name[5] = “Ann”; A n n \0 0x2000 0x2004 name = 0x2000 Kí t ựñ ánh d u k ế t thúc xâu (kí t r ng) char name[5] = {’A’,’n’,’n’,’\0’}; Khai báo t 01b001a1 ng ñ01b001a1 ng: Khai báo chu i (ti ế p) Khai báo 2: char name[] = “Ann”; A n n \0 0x2000 0x2003 name = 0x2000 L y thêm m t ô kí t cho ‘\0’ Chú ý: char name[] = ‘Ann’; A n n 0x2000 0x2002 name = 0x2000 Không có kí t k ế t thúc xâu (
Image of page 1

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern