C
c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#include <stdio.h>
#include <stdlib.h>
struct book
{
char *title,*author;
int *code;
double *price;
};
int main(int argc, char *argv[]) {
struct book *pointer;
pointer=(struct book*)malloc(sizeof(struct book));
pointer->title=malloc(100);
pointer->author=malloc(100);
pointer->code=malloc(sizeof(int));
pointer->price=malloc(sizeof(double));
puts("----Type in the title, the author, the code and the price of a book----");
fgets(pointer->title,100,stdin);
fgets(pointer->author,100,stdin);
scanf("%d",pointer->code);
scanf("%lf",pointer->price);
printf("Title: %s, Author: %s, Code: %d, Price: %lf",pointer->title,pointer->author,*pointer->code,*()pointer->price);
free(pointer->price);
free(pointer->code);
free(pointer->author);
free(pointer->title);
free(pointer);
Enter to Rename, Shift+Enter to Preview
OUTPUT
Run