Yeah, I realized that. Look at the edit.
Type: Posts; User: Babkockdood
Yeah, I realized that. Look at the edit.
You can put as many statements as you want on one line.
if (!argv[1]) printf("There are no arguments.\n"); return 1;
else printf("There is at least one argument.\n"); return 0;
EDIT: Ah,...
#include <stdio.h>
int main() {
int x = 8, y;
printf("Enter the magic number: ");
scanf("%d", &y);
if (y == x) printf("Correct.\n");
else printf("Incorrect.\n");
...
I've always preferred if-else over switch-case. Mostly because it's easier to read and more compact.