-
-
Save Shameera17/118d6e13fb849ab5668d0ea4068f38fe to your computer and use it in GitHub Desktop.
Hello, World in C
This file contains hidden or 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 hidden or 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 hidden or 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