Directory Listing | |
---|---|
calloc.c
|
|
hello_world.c
|
|
makefile
|
|
malloc_free.c
|
|
new_delete.cpp
|
|
realloc.c
|
|
string_ex1.c
|
|
string_ex2.c
|
|
struct_ex1.c
|
|
struct_ex1.cpp
|
|
struct_ex2.c
|
|
struct_func_ex.c
|
|
struct_func_ex.cpp
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#include <stdio.h>
#include <string.h>
int main(int argc, char **argv) {
//Argument check
if (argc != 3) {
fprintf(stderr, "usage: %s str1 str2\n", argv[0]);
return 1;
}
printf("str1 = %s\nstr2 = %s\n", argv[1], argv[2]);
//Let's see if they are the same...
int comp = strcmp(argv[1], argv[2]);
if (comp == 0)
printf("Both strings are the same!\n");
else
printf("The strings are different (ret %d).\n", comp);
return 0;
}