Skip to content

Conversation

robertoraggi
Copy link
Owner

Enough for

int printf(const char *format, ...);

int main() {
  char c = 'A';
  int i = 42;
  float f = 3.14f;
  double d = 2.71828;
  const char *str = "Hello, World!";

  printf("Character: %c\n", c);
  printf("Integer: %d\n", i);
  printf("Float: %.2f\n", f);
  printf("Double: %.5f\n", d);
  printf("String: %s\n", str);
}
$ cxx x.c -toolchain macos -c

$ ld x.o -syslibroot /Library/Developer/CommandLineTools/SDKs/MacOSX15.sdk -lSystem

$ ./a.out 
Character: A
Integer: 42
Float: 3.14
Double: 2.71828
String: Hello, World!

@robertoraggi robertoraggi merged commit 646b231 into main Aug 12, 2025
9 checks passed
@robertoraggi robertoraggi deleted the nutritious-earthworm branch August 12, 2025 19:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant