when i enter floading point numbers then go to function to check there is no character then go to showdata function to show the the number it doesn't show 0.0000 if i put showdata function in the main it shows the right value
could u help me what is wrong with it
cheers!
#include <stdio.h>

typedef struct tagStock
{
char wholesale[100];
float wholesaleprice;

}Stock;

int i;
char ex;
//*************prototype***************
void ShowData();
float WholesaleP(char wholeP[],Stock *stk);
//******Main**********
void main()
{
struct Stock sta;

bool k;
int a;
WholesaleP(sta.wholesale,&sta);

ShowData();
}
//************function****************
float WholesaleP(char wholeP[],Stock *stk)
{

do
{
printf("Enter wholesale price : ");
scanf("%s",wholeP);
for(i = 0; wholeP[i] && isdigit(wholeP[i]) || wholeP[i]=='.'; i++) ;

} while(wholeP[i]);
stk->wholesaleprice= atof(wholeP);
return 1;
}

//=======Show Data function=================
void ShowData()
{
struct tagStock sta;
printf("Wholesale price : ");
printf("%f\n",sta.wholesaleprice);
}