Hello i have a problem with getting the input from a user to match with values in an array of records..
here is my code
Code:
#include <stdio.h>#include <conio.h>
struct records
{
char name[10];
};
struct records n[2] =
{
{"andre"},
{"brown"}
};
int main()
{
//want to scanf a value to test if the name exist;
char input[10];
int i;
printf ("Enter name: ");
scanf ("\n\n%s", input);
for (i = 0; i < 2; i++)
{
if (n[i].name == input)
{
printf ("Name Exist in record %d \n", i);
}
else
{
printf ("Name does not exist in record %d \n", i);
}
}
getch();
}
using a watch i found out tht.. the input from the user if the user types "andre" is being stored as "andre\0@\0x01\0"
how do i get my program to jst store the word the user types?
please help