Hello, please give me the code for this project in C Programming. Thank you. Cus
ID: 3829946 • Letter: H
Question
Hello, please give me the code for this project in C Programming. Thank you.
CustInfo * findCustomer(CustInfo arr[], int size, char *ssn);
This function should return a pointer to the element in array arr that contains the customer whosesocial security number is equal to the given argument ssn . Hint: you should use strncmp with n=4.
SSN First Name Last Name
----------------------------------------------------------------
xxx-xx-3192 Farhad Akbar
xxx-xx-0721 Bassam Awad Alanazi
xxx-xx-9210 Roger Cungtha Biak
xxx-xx-7226 Christian C. Collier
xxx-xx-0802 Tanner Durnil
xxx-xx-1155 Melissa Gudeman
xxx-xx-7530 Daniel Patrick Kobold Jr
xxx-xx-8162 Travis Lee Leondis
xxx-xx-0011 Cleopatrio Soares Neto
xxx-xx-5533 Daniel Biaklian Sang
xxx-xx-1100 Bryant Bernard
xxx-xx-8123 Joaquin John Garcia
xxx-xx-3128 Jacob Austin Shebesh
xxx-xx-9011 D'Artagnan S. Engle
xxx-xx-1234 You Zhou
xxx-xx-4321 Joi Ashlyn Officer
Explanation / Answer
Please find my implementation.
Please let me know in case of any issue.
CustInfo * findCustomer(CustInfo arr[], int size, char *ssn){
int i = 0;
for(i=0; i<size; i++){
// skipping xxx-xx- by adding 7
if(strncmp(arr.ssn+7, ssn+6, 4) == 0)
return &arr[i];
}
return NULL;
}
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.