Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <string.h>
- #include <stdio.h>
- #include <stdlib.h>
- struct Book{
- char name[50];
- float price;
- char aName[50];
- }typedef book;
- void scanbarr(book* arr, int length, char* ref)
- {
- for(int i = 0 ; i < length ; i++)
- {
- book b = (*(arr+i));
- if (strcmp(b.aName,ref) == 0) {
- puts("found...");
- puts(b.name);
- break;
- }
- }
- puts("not found..");
- }
- void main()
- {
- book b1 = {"Starwars",32,"George Lucas"};
- book b2 = {"Starwars II ",64,"George Lucas II"};
- book* barr[5] = {};
- barr[0] = &b1;
- barr[1] = &b2;
- scanbarr(barr,2,"George Lucas");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement