Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <string.h>
- struct Book {
- char title[100];
- char author[100];
- int number_of_pages;
- };
- int main() {
- struct Book let_us_c;
- // you can ignore this comment block if you don't understand
- // THIS IS INVALID when we use an array
- // |
- // V
- // let_us_c.title = "Let Us C";
- // we need to use strcpy when we use an array
- strcpy(let_us_c.title, "Let Us C");
- strcpy(let_us_c.author, "Yashavant P. Kanetkar");
- let_us_c.number_of_pages = 593;
- printf("Information for let us c book\n");
- printf("Title: %s\n", let_us_c.title);
- printf("Author: %s\n", let_us_c.author);
- printf("Pages: %d\n", let_us_c.number_of_pages);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement