Last active
November 6, 2023 07:44
-
-
Save ramsey/11072524 to your computer and use it in GitHub Desktop.
Hello, World in C
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
int main() | |
{ | |
printf("hello, world\n"); | |
} | |
// Compile, then run `./a.out 1>stdout.txt 2>stderr.txt` | |
// Then run `echo $?` | |
// stdout.txt should contain "hello, world" | |
// stderr.txt should be empty | |
// Your `echo $?` command should return 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
int main() | |
{ | |
printf("hello, world\n"); | |
return 1; | |
} | |
// Compile, then run `./a.out 1>stdout.txt 2>stderr.txt` | |
// Then run `echo $?` | |
// stdout.txt should contain "hello, world" | |
// stderr.txt should be empty | |
// Your `echo $?` command should return 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
int main() | |
{ | |
fprintf(stdout, "hello, world\n"); | |
fprintf(stderr, "this is an error\n"); | |
return 1; | |
} | |
// Compile, then run `./a.out 1>stdout.txt 2>stderr.txt` | |
// Then run `echo $?` | |
// stdout.txt should contain "hello, world" | |
// stderr.txt should contain "this is an error" | |
// Your `echo $?` command should return 1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment