Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- struct Stock{char grade;
- float price;
- };
- void update_Stock(struct Stock*point, char grade, float price);
- void Display(struct Stock data);
- main() {
- struct Stock shell={'C',28.10},esso={'D',18.50};
- update_Stock(&shell,'A',128.50);
- update_Stock(&esso,'B',55.80);
- printf ("For shell:\n");
- display (shell);
- printf ("\nFor esso:\n");
- display (esso);
- return 0;
- }
- void update_Stock(struct Stock*point, char grade, float price){
- point->grade=grade;
- point->price=price;
- }
- void Display(struct Stock data){
- printf("The grade is %c\n",data.grade);
- printf("The price is %.2f\n",data.price);
- }
Advertisement
Add Comment
Please, Sign In to add comment