#include <stdio.h> float total(float, int); typedef struct BOOK { int serial; char title[30]; char author[30]; float price[30]; int quantity; }BOOK; int main() { BOOK a[2]; int x; float sum; for(x=0;x<2;x++) { printf("Please Enter Your Book Serial Number :\n"); scanf("%d", &a[x].serial); printf("Please Enter Your Book Title :\n"); scanf("%s", &a[x].title); printf("Please Enter Your Book Author :\n"); scanf("%s", &a[x].author); printf("Please Enter Your Book Price :\n"); scanf("%f", &a[x].price); printf("Please Enter Book Quantity :\n"); scanf("%d", &a[x].quantity); sum = total(a[x].price, a[x].quantity); } printf("Your Total Is : %.2f\n",sum); return 0; } float total(float z,int y) { return z*y; }
The type of the first parameter of the total function is float, while the type of BOOK::price is float*.
total
float
BOOK::price
float*
Quote:float price[30];
float price;
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)