My program should print out "Not found" not "Segmentation fault", what's happening here?
This is my code
#include <cs50.h>
#include <stdio.h>
#include <string.h>
int main(void)
{
string names[] = {"Bill", "Charlie", "Fred", "George", "Ginny", "Percy", "Ron"};
for (int i = 0; 1 < 7; i++)
{
if(strcmp(names[i], "Angle") == 0 )
{
printf("Found\n");
return 0;
}
}
printf("Not found\n");
return 1;
}
I complied the program with make and when I ran it, I got "Segmentation fault". So confused...