Hello. For one of my classes, I have to write a program that reads in a file that contains a string and looks for occurrences of substrings asked by the user. I am running this on Ubuntu by the way.
Anyway, the terminal commands are
echo "abcdefgh" > bar
./file bar bc
where file is the name of my program, bar is the file that "abcdefgh" is saved to, and bc is the string the user wants to find. The code for my program is below
I am receiving the Segmentation Fault error but have no idea where the problem is or how to fix it. If someone could tell me, that would be great.
int main(int argc, char *argv)
printf("The string appeared: %d times\n",count);