Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Structure in C #14

Open
0759537471 opened this issue Oct 19, 2024 · 0 comments
Open

Structure in C #14

0759537471 opened this issue Oct 19, 2024 · 0 comments

Comments

@0759537471
Copy link

#include<stdio.h>
#include<string.h> //strcpy

struct Book {
char Title[30];
char author[30];
int year;
char ISBN[13];
float price;

} Book1,Book2;

int main() {

strcpy(Book1.Title ,"introduction to c programming");
strcpy(Book1.author, "john smith");
Book1.year=2022;
strcpy(Book1.ISBN, "9780131103627");
Book1.price=49.99;

printf("Title:%s\n", Book1.Title);
printf("author:%s\n", Book1.author);
printf("publication year:%d\n", Book1.year);
printf("ISBN:%s\n", Book1.ISBN);
printf("price:%.2f", Book1.price);

return 0;

}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant