I have to process command line input and if one of the arguments equal to "-?", I have to write an explanation of what I am making here is what my code looks like:
#include <stdio.h>
#include <string.h>
#include "header.h"
#define ul unsigned long
int main(int argc, char *argv[]){
for(int i = 0; i < argc; i++){
printf("%s\n", argv[i]);
}
if(argc > 1){
if(strcmp(argv[1], "-?") == 0){
printf("Here I compare 2 strings using my prototype of strcmp(). You have to pass .\\a.out and 2 strings you want to compare.\nIf you want to see their length, type -v after passing values of strings:)\n");
}
}
if(argc > 3){
if(strcmp(argv[3], "-v") == 0){
printf("The length of the 1st string: %lu\nThe length of the 2nd string: %lu\n", strlen(argv[1]), strlen(argv[2]));
}
}
char *s1 = argv[1];
char *s2 = argv[2];
printf("%i\n", strcmp1(s1, s2));
}
and this is what I get if I pass ./a.out -?
:
zsh: no matches found: -?
So, my question is how do i process "-?"?