Objective-c Common Data Types

Source: Internet
Author: User

Basic Data Type

 

1. int
Output Format: % I, % d, % o % x,

2. Float
Output Format: % F, % E, % G

3. Double
Output Format: % F, % E, % G

4. Char

Output Format character: % C

 

Qualifier:


1. Long
Long INT: % Li
Long double: % lf
To form a long int, add L after the number.
Long int number = 123324123234123l;

2. Long
Long long INT: % llI

3. Short
Short INT: % Hi

4. unsigned

5. Signed

 

The number of bytes each occupies.

 

# Import<Foundation/Foundation. h>

IntMain (IntArgc,Const Char* Argv []) {

NSAID utoreleasepool* Pool = [[NSAID utoreleasepool Alloc]Init];

Nslog(@ "The size of an int is: % d bytes .",Sizeof(Int));

nslog ( @" the size of a short Int Is: % d bytes. ", sizeof ( short int ));

nslog ( @" the size of a long Int Is: % d bytes. ", sizeof ( long int ));

Nslog(@ "The size of a char is: % d bytes .",Sizeof(Char));

Nslog(@ "The size of a float is: % d bytes .",Sizeof(Float));

Nslog(@ "The size of a double is: % d bytes .",Sizeof(Double));

Nslog(@ "The size of a bool is: % d bytes .",Sizeof(Bool));

[PoolDrain];

Return 0;

}

 

09:29:16. 475 sizeoftest [860: 903] the size of an int is: 4 bytes.

09:29:16. 478 sizeoftest [860: 903] the size of a short Int Is: 2 bytes.

09:29:16. 478 sizeoftest [860: 903] the size of a long Int Is: 8 bytes.

09:29:16. 479 sizeoftest [860: 903] the size of a char is: 1 bytes.

09:29:16. 479 sizeoftest [860: 903] the size of a float is: 4 bytes.

09:29:16. 479 sizeoftest [860: 903] the size of a double is: 8 bytes.

09:29:16. 480 sizeoftest [860: 903] the size of a bool is: 1 bytes.

Logout

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.