#include <stdio.h>
#include <stdlib.h>
#include <conio.h>
#include <string.h>
struct BOOK{
char name[15];
char author[33];
int year[33];
};
struct BOOK *books;
int main(){
int i,noBooks;
noBooks=2;
books=malloc(sizeof(struct BOOK)*noBooks);
books[0].year=1986;
books[0].author="JackLondon";
books[0].name='MartinEden';
getch();
return 0;
}
my code is that. when i use scanf
it works but i cant appoint directly like that.
errors are:
error: incompatible types when assigning to type 'int[33]' from type 'int'|
error: incompatible types when assigning to type 'char[33]' from type 'char *'|
error: incompatible types when assigning to type 'char[15]' from type 'int'|
Build finished: 3 errors, 1 warnings
how can i appoint directly, where is my wrong?