I am writing a C program which searches for a string inside a file. When I compile and execute the program from the command line, I get the segmentation fault error. I know that this error means that I do not have access to the memory I am trying to write to, but I do not see how this is occurring in my program. Here is the segment of code in my main
function where the error is occurring:
int num_of_arguments = argc;
char *filename = argv[2];
char *search_string;
strcpy(search_string, argv[1]);
int i = 0;
while (search_string[i]) {
tolower(search_string[i]);
i++;
}