Objective-C

Also known as: ObjC

Objective-C is C plus a Smalltalk-style dynamic message-send object model. Long the main language for macOS / iOS; largely superseded for new code by Swift.

#import <Foundation/Foundation.h>

NSString *greet(NSString *name) {
  return [NSString stringWithFormat:@"hello, %@", name];
}

int main(int argc, const char *argv[]) {
  @autoreleasepool {
    NSLog(@"%@", greet(@"world"));
  }
  return 0;
}

← Back to CS Glossary