c - Implementing a Linear Search -
Question: Read up to 6 pairs of names and ages in two different arrays, and use a linear search Find the target name and print the person's age. Two arrays are called names and ages: I am getting many errors ... I am sure that the function is not being passed to an array .. < Pre> Please help. The error is as follows: Results = Linear Search (& amp; No, & amp; Temporary []); # include & lt; Stdio.h & gt; # Defined ASIZE 20 # defined RECSIZE 6 string record {char name [ASIZE]; Acute age [ASGE]; }; No record [RECSIZE]; Int linear search (structure record * find A, four *) {int x; (X = 0; x & lt; RECSIZE; x ++) {// if (no [x] .name == [x] get] if (a-> gt; x [x] == [x] looks {Return x;}} return -1;} for int main () {int i; (i = 0; i & lt; RECSIZE; i ++) {printf ("Enter name:"); scanf ("% s", no [i] .name); Printf ("Enter age:"); scanf ("% i", & amp; na [i] .age);} printf ("Enter search name : "); Four floating [ASGE]; scanf ("% s ", temporary [ASIZE]); full results; result = linear search (& amp; not; & amp; temp []); printf ("% i " Please return help;
#include
Comments
Post a Comment