Basics of Objective-C

A summary of basics of Objective-C

Example: Hello World

The first, and simplest program in o-c:

    #import <Foundation/Foundation.h>

    int main() {
      @autoreleasepool {
      NSLog(@"Hello, World!");
      return 0;

How to Edit and Run Hello World

The standard way is to create a command-line tool using xcode. xcode will give a simplest .m file, in which we can input the source code.

We can write o-c programs in any other text editors, like textmate, nano, vim, etc. And compile it and run Suppose you have named your source file as "test.m"

    `clang -fobjc-arc test.m -o test`