我想通过将它们与给定的结构数组进行比较来创建一个函数,该函数获取一本书的标题和作者并返回 0 或 1(如果可用或不可用)..... 编译器显示:
structs.c:10:28: error: expected ‘)’ before ‘title’
structs.c: In function ‘main’:
structs.c:59:21: error: expected expression before ‘bookRecord’
structs.c:60:13: error: expected expression before ‘bookRecord’
structs.c:61:9: warning: implicit declaration of function ‘requestBook’
structs.c:61:23: error: expected expression before ‘bookRecord’
这是代码:
  #include<stdio.h>           
  #include <stdlib.h>
  #include <string.h>
 #define TRUE 1
 #define FALSE 0
 #define NUM_BOOKS 5
 int requestBook(bookRecord title[],bookRecord author[]){    /* compiler error :10*/
          int i;
          for(i=0;i<=NUMBOOKS;i++){
                  if(strcmp(stacks[i].tittle ,bookRecord.title[0]) == 0 &&                                                                              
                  strcmp(stacks[i].author     ,bookRecord.author[0]) == 0 ){
                  return 1;
                   }
           }
                   return 0;
  }
         typedef struct {
        int minute; 
        int hour;   
         } timeT;
    typedef struct {
       char title[50];  
       char author[50];     
       int year;        
       int isOut;                   
       timeT time;      
       int isBlank;         
  } bookRecord;
  /* given array of struct */
    bookRecord stacks[NUM_BOOKS]=
       {
       {"C How To Program", "Deitel", 2006, FALSE, {0,  0}, TRUE} ,
       {"The Old Capital", "Yasunari Kawabata", 1996, FALSE, { 0, 0}, TRUE},
       {"", "", 0, FALSE, {0,0}, FALSE},
       {"", "", 0, FALSE, {0,0}, FALSE},
       {"", "", 0, FALSE, {0,0}, FALSE}
       };
 int main (int argc, char*argv[]) { 
    int t;
    scanf("%s ",bookRecord.title[0]);         /* compiler error :59*/
    scanf("%s",bookRecord.author[0]);     /* compiler error :60*/
     t=requestBook(bookRecord.title[0], bookRecord.author[0]);   /* compiler error :61
     printf("%d",t);
     return 0;
 }
任何帮助表示赞赏!
////////////////////////////////////////
如果您想查看最终解决方案,请访问 STRUCT CONFUSION(2) 它是重复的
////////////////////////////////////////