Objective-c language: First OC program

Source: Internet
Author: User

Objective-c is the base language for iOS development, hereafter referred to as OC

1, OC and C language header file differences:

#import: #include一样都是编译预处理指令

#import function is the same as # include to copy the contents of the file to the location of the #import directive

#import <> and #include <> are the header files that are used to include the system.

#import "and #include" "are used to include header files in your own project

#import is a # include upgrade that automatically prevents file duplication

2, Foundation: is the foundation framework

3, @autoreleasepool is a memory management of a thing, roughly know it can be

4. Functions provided by the Nslog:foundation framework for log output

5. Comparison between NSLog and printf

Comparison between NSLog and printf

5.1, printf is provided in the C language, it in the stdio.h header file

5.2, NSLog is provided by the Foundation framework, NSObjCRuntime.h

5.3. NSLog contains the date of the log output, and the corresponding application

5.4, NSLog automatic line, at the end \ n is invalid

5.5. The format string in NSLog is not a normal C-language string, NSString object

@ "" It is a literal representation of a NSString object

5.6. All placeholders in printf are supported in OC

5.7, nslog new format character%@ for the output of the object

6, in the main function, Renturn 0; indicates that the program exited normally.

Objective-c language: First OC program

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.