1. Create a hello WorldProgram
1. Start xcode, file-> new project
Select command line utility on the left and foundation tool on the right.
2. Compile and run
Click build and go or command + R to compile and run the program.
Run-> console, or command + Shift + R, you can open the xcode Console window and see the running result.
II,CodeBasic
1. You can use # import instead of # include to include header files,
Import will automatically ensure that only one time is included, so you do not need to use # ifdef # endif as # include to ensure that only one time is included.
2. nslog (@ "Hello world !")
NS is the prefix of the system class, short for nextstep,
2.1. nslog is basically the same as printf in C, but there are some differences.
There are new features, timestamps, date stamps, and automatic attachment line breaks '/N'
2.2, @ symbol, the @ symbol before the string. the symbol references the nssting type, which is different from the C-style string.
@ Symbol hiding meaning: All @ symbol content marks the extension of objective-C to C Language
Nsstring feature: gets the length, which is converted to an integer or floating point number compared with other strings.
Insert a C-style string in nslog with % s, insert nsstring with % @
Based on the above information, you can use nslog to implement the hello wrold program.
2.3, bool
The bool of objective-C is similar to that of C language, which occupies 1 byte. Use # define, yes is 1, and no is 0.
The difference is that non-0 in C is true, and only one byte is recognized,
If 0x3200 is assigned to bool, the result is 0, no, rather than yes.