I enter the value , but the program doesn't capture the value
what's the problem ?
Code:#include<stdio.h> struct book { float fPrice; int iNumPages; int iYear; }; void get_details( float* , int*, int* ); int main() { struct book sMybook = { 25.50 , 690 , 2005}; struct book sHerbook; float fdiff; float x; int y, z; get_details( &x ,&y ,&z); x=sHerbook.fPrice; y=sHerbook.iNumPages; z=sHerbook.iYear; printf("My book :\n"); printf("%.2f\t%d\t%d\n", sMybook.fPrice, sMybook.iNumPages, sMybook.iYear ); printf("Her book :\n"); printf("%.2f\t%d\t%d\n", sHerbook.fPrice, sHerbook.iNumPages, sHerbook.iYear); fdiff = sMybook.fPrice - sHerbook.fPrice; printf("the difference in price is %.4f\n", fdiff ); if (sMybook.iYear > sHerbook.iYear ) printf("Mine is greatest "); else printf("Her's is greatest"); return 0; } void get_details( float*a , int*b , int*c ) { printf("enter book price:\n"); scanf("%f", a); printf("Enter number of pages:\n"); scanf("%d", b); printf("Enter year:\n"); scanf("%d", c ); }
someone please correct me
Thank you !



1Likes
LinkBack URL
About LinkBacks


