|
CS256 - Principles of Structured Design
Fall 2021
|
Displaying ./code/cs256su21code/jul06/strcmp2.c
/*
pretty much the same program as strcmp.c, execpt we specify what we're comparing
instead of comparing one string with something hardcoded in.
also note that strcmp is case-sensitive, so "Dog" and "dog" are, as far as strcmp is concerned,
different strings, because it is using ASCII values to make that determination.
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(int argc, char *argv[]){
if(argc < 3){
printf("Usage: %s something something\n", argv[0]);
exit(1);
}
if(strcmp(argv[1], argv[2]) == 0){
printf("these are the same\n");
} else {
printf("these are not the same\n");
}
return 0;
}
|