- Chapter 3: Variables and Basic Data Types. - Variables and Basic Data Types. - [1] “C: How to Program”, 7 th Ed. - Data and Data Types. - enum Data Type. - struct Data Type. - electronic form that can be stored and processed by a computer. - form that can be stored and processed by a computer. - Data Types. - Data Types in C. - Built-in data types (primitive/fundamental). - Derived data types. - Built-in Data Types in C. - numbers (6 digits of precision) float 4 bytes -3.4e+38 to 3.4e+38 Double-precision floating-point. - numbers (15 digits of precision) double 8 bytes -1.797693e+308 to 1.797693e+308. - Promotion hierarchy for data types ([1], p. - Type name: char. - Values can be used as numbers instead of characters.. - Type name: int. - Values can be used with the operators:. - Type name: float. - Range: -3.4e+38 to 3.4e+38. - Type name: double. - If no enumerations with = appear, then the values of the corresponding constants begin at 0 and increase by 1 as the declaration is read from left to right.. - Structures can be nested. - Size of a struct data type is a total sum of all the sizes of the types of its members.. - returns a structure of the right type.. - structure-name.member 34. - Data Type. - New Type Name Definition. - A mechanism for creating synonyms (or aliases) for previously defined data types. - typedef old_type_name new_type_name;. - No new data type is created with typedef.. - A variable is a location in memory where a value can be stored for use by a program.. - All variables must be defined with a name and a data type before they are used in a program.. - Local variables. - Variable names actually correspond to locations in the computer‟s memory.. - X: min#, 123Iteration, ThisVar., @g_Variable. - A data type of a variable is specified in its declaration.. - variables up to the data type and its storage class at run time.. - A compiler associates variable_name to the allocated memory.. - A compiler sets initial_value to the content of the allocated memory if initial_value exists. - type_name variable_name_1. - variable_name_2. - variable_name_n. - A value of each local variable can be set in its declaration.. - The scope of a name is the part of the program within which the name can be used.. - A scope of a variable name is a region of the program (function. - Local variables of the same name in different functions are unrelated.. - The same is true for the parameters of the function, which are in fact local variables.. - The scope of an external variable or a function lasts from the point at which it is declared to the end of the. - Initialized data .data. - Read-only memory for string constants and other data whose values are known at compile time, existing for the lifetime of the program. - Read-writable memory for extern/static variables existing for the lifetime of the program. - Constants can be of any of the basic data types like an integer constant, a. - const type_name variable_name = value;. - The C language has no boolean data type.. - Data type of the variable and data type of RHS must be the same.. - Otherwise, data type of RHS will be casted to data type of the variable.. - A pair of expressions separated by a comma is evaluated left-to-right, and the value of the left expression is discarded.. - The type and value of the result are the type and value of the right operand.. - All side effects from the evaluation of the left- operand are completed before beginning the. - evaluation of the right operand. - If the value of <expression1>. - Copy 1 to the variable min min = 1;. - Produces the value of expression in the type. - address &Variable Returns the address of the. - Dereferencing *Pointer Returns the value of the. - Calculate and print the length of the diagonal line of a given. - Data types. - No change during the execution of the program. - collected for examination and consideration and used to help decision-making, or information in an electronic form that can be stored and
Xem thử không khả dụng, vui lòng xem tại trang nguồn hoặc xem
Tóm tắt