Hello, World
#import <stdio.h>
int main(void) {
printf("Hello, World!\n");
return 0;
}Tap Run to execute
main.m · output appears here
Press Run to execute
Output streams here as your program runs.
Objective-C is an object-oriented language that adds Smalltalk-style messaging on top of C. For decades it was the primary language for Apple's macOS and iOS development, built around classes, message sending with bracket syntax, and a dynamic runtime. It remains widely used in legacy Apple frameworks and interoperates cleanly with C and C++ code in mixed-language projects.
On CompileBytes, Objective-C programs are compiled with GCC (reported as version 12.2.0) rather than Apple's Clang, so platform-specific Cocoa frameworks like UIKit and Foundation may be unavailable. Plain C-style programs and basic Objective-C class definitions using the GNUstep runtime work well, making it suitable for learning the messaging syntax, memory model, and core language concepts without a Mac.
main.m is the entry point. Add helper files from the explorer and import them into your project.
Use the Input panel to pipe standard input to your program when it needs data.
Run sends your code to a fresh hosted runtime and streams the result into the output panel.
Your draft stays in this browser, and Share creates a separate snapshot link.
main.m imports a header containing a small inline C-compatible helper.
#import <stdio.h>
#import "helper.h"
int main(void) {
printf("%d\n", answer());
return 0;
}
#ifndef HELPER_H
#define HELPER_H
static inline int answer(void) { return 42; }
#endif
#import <stdio.h>
int main(void) {
printf("Hello, World!\n");
return 0;
}#import <objc/Object.h>
#import <stdio.h>
@interface Greeter : Object
- (void)greet:(const char *)name;
@end
@implementation Greeter
- (void)greet:(const char *)name {
printf("Hello, %s!\n", name);
}
@end
int main(void) {
Greeter *g = [Greeter new];
[g greet:"CompileBytes"];
return 0;
}#import <stdio.h>
long factorial(int n) {
return n <= 1 ? 1 : n * factorial(n - 1);
}
int main(void) {
for (int i = 1; i <= 5; i++) {
printf("%d! = %ld\n", i, factorial(i));
}
return 0;
}#import <stdio.h>
int main(void) {
char name[64];
printf("Enter your name: ");
if (scanf("%63s", name) == 1) {
printf("Hi, %s!\n", name);
}
return 0;
}#import <objc/Object.h>
#import <stdio.h>
@interface Calc : Object
- (int)add:(int)a to:(int)b;
@end
@implementation Calc
- (int)add:(int)a to:(int)b {
return a + b;
}
@end
int main(void) {
Calc *c = [Calc new];
printf("sum = %d\n", [c add:3 to:4]);
return 0;
}#import <stdio.h>
typedef struct {
int x;
int y;
} Point;
int main(void) {
Point p = {3, 4};
Point *ptr = &p;
printf("(%d, %d)\n", ptr->x, ptr->y);
return 0;
}#import <objc/Object.h>
#import <stdio.h>
@interface Counter : Object
{
int value;
}
- (void)increment;
- (int)value;
@end
@implementation Counter
- (void)increment { value++; }
- (int)value { return value; }
@end
int main(void) {
Counter *c = [Counter new];
[c increment];
[c increment];
printf("count = %d\n", [c value]);
return 0;
}#import <stdio.h>
int main(void) {
int nums[5] = {1, 2, 3, 4, 5};
int sum = 0;
for (int i = 0; i < 5; i++) {
sum += nums[i];
}
printf("sum = %d\n", sum);
return 0;
}The editor uses Monaco, the engine behind VS Code, with language-aware editing tools and familiar keyboard controls.
Type or paste your code into the editor, then click Run (or press Ctrl/Cmd + Enter) to execute it.
Output streams into the console panel, including runtime errors, exit status, and execution time.
Nothing to install and no account to create — code runs in an isolated hosted runtime.
Language-aware autocomplete and IntelliSense suggestions where the editor has a matching language service
Syntax highlighting, with native compiler and runtime errors shown in the console
Bracket matching, auto-indentation, code folding, and a minimap
Multi-cursor editing plus find & replace (Ctrl/Cmd + F)
Full undo/redo history and copy to clipboard
Built on Monaco — the same editor that powers VS Code
Run on demand, or turn on Auto-run to execute on every change
Stop long-running or infinite programs at any time
A real console shows standard output, errors, exit status, and execution time
Pass standard input (stdin) to your program from the Input panel — one value per line
Switch between light and dark themes
Adjust font size and other editor settings
Toggle side-by-side or top/bottom layouts
Enter distraction-free fullscreen mode
Generate a shareable link to your exact code in one click — no login needed
Your work autosaves to your browser, so you can pick up where you left off
Copy the active file to your clipboard
Run code: Ctrl/Cmd + Enter
Find & replace: Ctrl/Cmd + F
Open the full shortcut list from the keyboard icon in the toolbar
Objective-C is one of 23 linked-project compilers. Run always starts main.m; selecting a helper tab changes what you edit, not the entry file.
main.m imports a header containing a small inline C-compatible helper.
Linked-project languages (23): Node.js, TypeScript, Deno, Python, C, Go, Dart, Swift, Rust, Ruby, PHP, Java, Kotlin, C++, C#, Nim, Crystal, Haxe, Zig, Scala, D, Bun, Objective-C.
Single-file scratchpads (46): Matplotlib, NumPy, pandas, Haskell, Clojure, Perl, Lua, Tcl, jq, Raku, Elixir, Bash, Zsh, Nushell, R, Assembly (NASM), Julia, Octave, Groovy, PowerShell, Visual Basic .NET, Odin, Pascal, Lisp, Erlang, CoffeeScript, COBOL, BASIC, V, Racket, OCaml, Prolog, AWK, Emacs Lisp, Emojicode, Forth, F#, Fortran, Assembly (NASM64), Solidity, Mojo, Ada, WASM (WAT), Gleam, Shell Script (sh), Scheme. Their extra project files are not submitted to the runtime.
Download project exports every Objective-C tab and a README in one ZIP archive.