Let's take a picture of the C data type first, as shown in figure
650) This. width = 650; "src =" http://s3.51cto.com/wyfs02/M00/45/D1/wKiom1PsFlbz4ROYAADPAyT_cBQ963.jpg "Title =" CDATA ).png "alt =" wkiom1psflbz4royaadpayt_cbq963.jpg "/>
The length of the basic data type. data is stored in bytes and transmitted in BIT, one digit represents a 0 or 1 (Binary), and one byte occupies 8 bits ).
#import <Foundation/Foundation.h>int main(int argc, const char * argv[]){ @autoreleasepool { short int shortIntType = 1; int intType = 2; long longType = 3L; float floatType = 4.1f; double doubleType = 5; char charType = ‘A‘; printf("size of short it is %lu Byte\n",sizeof(shortIntType)); printf("size of int is %lu Byte\n",sizeof(intType)); printf("size of long is %lu Byte\n",sizeof(longType)); printf("size of float is %lu Byte\n",sizeof(floatType)); printf("size of double is %lu Byte\n",sizeof(doubleType)); printf("size of char is %lu Byte\n",sizeof(charType)); } return 0;}
The output result is as follows:
650) This. width = 650; "src =" http://s3.51cto.com/wyfs02/M01/45/D3/wKioL1PsHariJP-nAACZhpcU_3k250.jpg "Title =" length. PNG "alt =" wKioL1PsHariJP-nAACZhpcU_3k250.jpg "/>
This article is from the "7803002" blog, please be sure to keep this source http://7813002.blog.51cto.com/7803002/1539769