Hi, I'm unable to make new structures and assign values to its attributes.
Problem 1: Unable to assign new attributesRunning the code below, the book title is empty for some reason.
Is there something wrong with the way I'm inserting the attribute value?
typedef struct Books {
char title[50];
} Book;
int main( ) {
Book book;
book.title = "C Programming";
printf( "Book title : %s\n", book.title);
printf( "%s asd", book.title);
return 0;
}
Zorro log:
test_struct compiling........... ok
Book title : asd
Problem 2: I'm unable to make a function that initializes these values for meThis is the code to repeat the error.
typedef struct Books {
char title[50];
} Book;
Book makeBook()
{
Book book;
book.title = "C Programming";
return book;
}
int main( ) {
Book book = makeBook();
printf( "Book title : %s\n", book.title);
printf( "%s asd", book.title);
return 0;
}
Error:
test_struct compiling.........
Error in 'line 10:
Syntax error: Wrong type SETRETV:::STRUCT@16
< return book;
>
Understand its slightly basic. But happy to receive any help on this.
Many thanks