Hi,
Iam using different tutorials and sadly the lecture from Harvard on YT always uses a custom made "cs50.h" library which in the end just complicate things because I have to figure then things out myself, or is everyone using it ? I guess not so I obviously dont want to rely on it.
Well here is a simple phonebook search, at least Iam not getting any errors anymore but the code also doesnt print out anything, any help would be appreciated.
Code:
#include <stdio.h>
#include <string.h>
typedef struct
{
char name[20];
char phone[20];
}
Phonebook;
int main()
{
Phonebook people[2];
Phonebook kevin;
strcpy(kevin.name, "Kevin Schmidt");
strcpy(kevin.phone, "827123");
Phonebook maik;
strcpy(maik.name, "Maik Mueller");
strcpy(maik.phone, "67322188");
char find[20];
printf("Name to find ?: ");
scanf("%s", find);
for(int i = 0; i < 2; i++)
{
if(strcmp(people[i].name, find) == 0)
printf("Found %s\n", people[i].phone);
}
return 0;
}
But maybe the whole thing is wrong I have no clue, thanks in advance as always :).