IOS network programming-Day3 (C language supplement)

Source: Internet
Author: User

IOS network programming-Day3 (C language supplement)
1. constant classification (1) integer constants are only in decimal notation. Positive and negative integers. % d. Decimal placeholders. Integer constants are printed in decimal notation. % o octal placeholders. Integer constants are printed in octal notation. % x hexadecimal Placeholders are expressed in hexadecimal notation. in hexadecimal mode, print Integer constants 10 in hexadecimal form, write 238 in hexadecimal form, write 0 at the beginning, 02316 in hexadecimal form, write ox at the beginning, ox23 short int, 2 bytes, 16-Bit Signed (plus or minus) -32768 ~ 32767 int 4-byte 32-bit long int 8-byte 64-bit u unsigned int type ul/lu unsigned long integer can be divided into positive integers and negative integers, positive integers are stored as the original code, the negative integer is the complement storage, the first is the symbol bit, 0 represents a negative number, 1 represents a positive number 6 occupies two bytes, and the positive and negative values can be stored as 1000000000000110, to obtain the Complement Method: source code-> reverse code (to the opposite number)-> complement code (+ 1)-6 00000000000000110-> 1111111111111001-> 111111111111010 (2) real constants in the general form of real number: By integer, decimal point, decimal place. The integer or decimal part can be omitted, for example, 12.345, 47.0 ,-. 234, 47. exponential real number: it consists of the ending number, the letter e/E, and the decimal point, for example. 2e3, 1.2e-3 (3) character constant '0'-48 'a'-65 'a'-97 \ n line feed-10 \ t horizontal tabulation-9 \ B Return-8 \ r press ENTER-13 \ f page feed-12 \ Backslash "\"-92 \ 'single quotation marks-39 \ "Double quotation marks-34 \ ddd 1 to three Octal numbers represent a maximum of three characters after the slash octal digits \ xhh 1-2 hexadecimal digits represent a maximum of two hexadecimal digits after a slash x (4) enumeration constants generally define Integer constants. By default, they are counted from 0, followed by 1, starting from the set value, and adding 1 enum weekday {Monday, Tuesday, Wednesday = 11, thursday, Friday, Saturday = 33, Sunday}; int main (int argc, char * argv []) {@ autoreleasepool {return UIApplicationMain (argc, argv, nil, NSStringFromClass ([AppDelegate class]); printf ("% d", Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, sunday) ;}} (5) macro definition cannot add points (6) zero value, that is, character with ASCII code value 0 (7) NULL value number 0, \ 0, pointer NULL (8) const constant function: (1) modify a common variable and change the variable to a constant symbol (2) modify the pointer variable 2. pointer, a hexadecimal address to get the address: & % p: print out the value of the address in hexadecimal format: * pointer variable common form identifier * pointer variable name int a = 100; int * nA = & a; the same type of variable must be used to store the same type of variable address. If Initialization is not assigned a value, you need to initialize to NULL char * string variable const char * String constant 3. const modifier pointer (1) const int * p can change the address stored by p, but cannot change the data in the stored address (2) int const * p has the same effect (1) (3) int * const p; it must be initialized during definition and cannot change the address, but it can change the data in the storage address (4) const int * const p; neither change the address of p storage nor change the data in the storage address. Initialization is required during definition. static variables (1) modify local variables. The memory space is opened during the first call, and the memory is not recycled after the call. The previous data is retained. The memory and initialization are not reactivated when the call is made again (2) static global variables can be accessed by external files. Static global variables can only be used by this file. the extern keyword uses (1) the keyword condition for declaring the variable pre-Compilation: only one of the conditions is compiled, and the other is not compiled # if # else # endif

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.