daily pastebin goal
40%
SHARE
TWEET

Untitled

a guest Jan 21st, 2019 58 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <stdio.h>
  2. #include <string.h>
  3. #include <stdio.h>
  4. #include <stdlib.h>
  5.  
  6.  
  7.  
  8. struct Book{
  9.     char name[50];
  10.     float price;
  11.     char aName[50];
  12. }typedef book;
  13.  
  14. void scanbarr(book* arr, int length, char* ref)
  15. {
  16.     for(int i = 0 ; i < length ; i++)
  17.     {
  18.         book b = (*(arr+i));
  19.         if (strcmp(b.aName,ref) == 0) {
  20.             puts("found...");
  21.             puts(b.name);
  22.             break;
  23.         }
  24.     }
  25.     puts("not found..");
  26. }
  27.  
  28. void main()
  29. {
  30.     book b1 = {"Starwars",32,"George Lucas"};
  31.     book b2 = {"Starwars II ",64,"George Lucas II"};
  32.  
  33.     book* barr[5] = {};
  34.     barr[0] = &b1;
  35.     barr[1] = &b2;
  36.     scanbarr(barr,2,"George Lucas");
  37.  
  38. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top