#include<stdio. h>
#include<math.h >
main()
{
FILE * fp;
struct
{
int a;
float b;
}file;
fp = fopen("Y.TXT"," w+");
printf("enter the value of a :");
scanf("%d",&fil e.a);
printf("\n");
file.b =sin(file.a);
printf("%d",fil e.a);
printf("\n");
printf("%f",fil e.b);
fwrite(&file,si zeof(file),1,fp );
fclose(fp);
}
i am getting some garbage value into the file.can you tell me what may be the problem?
#include<math.h >
main()
{
FILE * fp;
struct
{
int a;
float b;
}file;
fp = fopen("Y.TXT"," w+");
printf("enter the value of a :");
scanf("%d",&fil e.a);
printf("\n");
file.b =sin(file.a);
printf("%d",fil e.a);
printf("\n");
printf("%f",fil e.b);
fwrite(&file,si zeof(file),1,fp );
fclose(fp);
}
i am getting some garbage value into the file.can you tell me what may be the problem?
Comment