Summary of learning data type
2016-09-29 19:47
375 查看
Summary of learning data type
16340286School of Data and Computer Science
Contents
Summary of learning data type
Brief Introdution
Storage size
Operator sizeof
Value range
Integer constants3
Positional Notation
References
Brief Introdution
In computer science and computer programming, a data type or simply type is a classification identifying one of various types of data, such as real, integer or Boolean, that determines the possible values for that type, the operations that can be done on values of that type, the meaning of the data, and the way values of that type can be stored.1
A set of values ,along with a set of operations on those values.
Storage size
Type | Size | |||
---|---|---|---|---|
char memory cell | ▇▇▇▇ | |||
short memory cell | ▇▇▇▇ | ▇▇▇▇ | ||
int memory cell | ▇▇▇▇ | ▇▇▇▇ | ▇▇▇▇ | ▇▇▇▇ |
long memory cell | ▇▇▇▇ | ▇▇▇▇ | ▇▇▇▇ | ▇▇▇▇ |
Operator sizeof
C has a unary operator named size of that yields the size on your machine in bytes of its single operand.The operand can be a variable name,or it can be the name of a data type enclosed in parentheses.2#include <stdio.h> #include <limits.h> int main() { printf("Storage size for char : %d \n", sizeof(char)); printf("Storage size for int : %d \n", sizeof(int)); return 0; }
Display:
Storage size for char : 1 Storage size for int : 4
Value range
Type | Value range | Operation |
---|---|---|
int | integer in INT_MIN~INT_MAX | +−∗/... |
float | a set of all real numbers the computer can state | +−∗/ |
char | -128~127 | +−∗/% |
Integer constants3
Any whole number value is an integer.An integer constant refers to a sequence of digits without a decimal point.
An integer preceded by a unary minus may be considered to represent a negative constant
There are three types of integer constants namely
a) Decimal integer constant
b) Octal integer constant
c) Hexadecimal integer constant
Positional Notation
The formula4 is:N=∑i=1ndiRi−1
n is the number of digits in the number
d is the digit in the ith position in the number
R is the baseof the number
Example:
03172=3*83+1*82+7*81+2*80=1658
0x67A=6*162+7*161+10*160=1658
References
https://en.wikipedia.org/wiki/Data_type#cite_note-1 ↩http://www.tutorialspoint.com/cprogramming/c_data_types.htm ↩
http://aboutc.weebly.com/integer-constants.html ↩
http://ss.sysu.edu.cn/~pml/se121/2011fall/slides/02-NumberSystem.pdf ↩
相关文章推荐
- 20162314 《Program Design & Data Structures》Learning Summary Of The Tenth Week
- 20162314 《Program Design & Data Structures》Learning Summary Of The First Week
- 20162314 《Program Design & Data Structures》Learning Summary Of The Eighth Week
- 20162314 《Program Design & Data Structures》Learning Summary Of The Seventh Week
- 20162314 《Program Design & Data Structures》Learning Summary Of The Fifth Week
- 20162314 《Program Design & Data Structures》Learning Summary Of The Eleventh Week
- 20162314 《Program Design & Data Structures》Learning Summary Of The Second Week
- 20162314 《Program Design & Data Structures》Learning Summary Of The Ninth Week
- 20162314 《Program Design & Data Structures》Learning Summary Of The Ninth Week
- dataType of jQuery.ajax()
- Trigger and datatype of 'sysname'
- ERROR: The version of SQL Server in use does not support datatype 'datetime2'.
- EF 6.0 The conversion of a datetime2 data type to a datetime data type resulted in an out-of-range value. c#中的时间
- Learning Data Binding with Windows Forms 2.0(1)-The Quest for Type Safety
- redis.clients.jedis.exceptions.JedisDataException: WRONGTYPE Operation against a key holding the wrong kind of value
- Courses of Data Mining & Machine Learning & Pattern Recognition
- No qualifying bean of type [org.springframework.data.mongodb.core.MongoTemplate]
- The Fundamentals of the SQL Server 2005 XML Datatype
- There is no ViewData item of type 'IEnumerable<SelectListItem>' that has the key ''.
- java第三课:原生数据类型是用陷阱(pitfall of Primitive Data Type)