TAILIEUCHUNG - Computer Programming for Teens phần 8

một người khác làm việc cho các chuỗi hoặc các ký tự được thêm vào. Khi các loại của các đối số ở hai bên của dấu + đọc, chức năng thích hợp cho dấu + được thực hiện. Khi bạn thăng tiến trong kỹ năng lập trình của bạn, bạn có thể tìm hiểu làm thế nào để viết các nhà khai thác của riêng của bạn quá tải. | 226 Chapter 14 But What If Things Are Different Structures Records and Fields variable types as well as names it is important you understand that you cannot use these words for variable names in your programs. The compiler when it encounters a reserved word will start to execute the command or commands associated with that word. If the compiler sees the word for it will assume that there is a loop that must be executed. This is just one example and it is the main reason why you cannot choose a reserved word as either a variable type or variable name. Declaring One or More Records Once you have defined the record you are ready to declare one or more records. When you declare a record you will be telling the compiler that a variable of type individual now exists. Remember because of the declaration you made to the compiler a new type individual now exists for the duration of that program this is in addition to the standard types int char double and so on. Let s declare two variables of type individual. individual first_person second_person Individual is not boldfaced because we want to emphasize that it is not a reserved word. Once you have declared these two new variables the compiler will set aside memory for each variable which includes memory for each of its fields. The name you give that individual is the variable name. Distinguishing Among the Record s Type the Record Variable and the Fields The most difficult part of dealing with records called structs in C is the confusion that arises from all the variable names that are part of the definition. Let s take a moment to clarify what each variable name struct record name and type refers to. When a record is defined the compiler is informed what it will contain and as a result sets aside the appropriate memory for everything that it contains. Each internal variable each field has its own type and memory requirements. Each record has to be given a name to identify it as a new type. That way a later declaration of .

Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.