Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

I keep getting an error message after char *name; stating my program.exe has sto

ID: 3624966 • Letter: I

Question

I keep getting an error message after char *name;
stating my program.exe has stopped working. What am I doing wrong? Everything seems to work okay??
#include<stdio.h>

int main()
{

char* name;


float bal,stbal,deposits[50],withdrawals[50];
int nw,nd,i;

printf("Welcome to the Sinclair Banking System.");

printf(" Please enter your first name: ");


printf(" Hello %s",name);
printf(" Now enter your balance in dollors and cents: ");
scanf("%f",&bal);
while(bal<0)
{
printf(" Balance amount should be greater than zero");
printf(" enter your balance in dollors and cents:");
scanf("%f",&bal);
}
stbal=bal;
printf(" Enter number of withdrawls: ");
scanf("%d",&nw);
printf(" Enter number of deposits: ");
scanf("%d",&nd);
for(i=0;i<nd;i++)
{
printf("Enter the amount of deposit#%d: ",i+1);
scanf("%f",&deposits[i]);
while(deposits[i]<0)
{
printf(" Deposit amount should be greater than zero");
printf(" Enter the amount of deposit#%d: ",i+1);
scanf("%f",&deposits[i]);
}
bal=bal+deposits[i];
}
printf(" ");
for(i=0;i<nw;i++)
{
printf("Enter the amount of withdrawl#%d: ",i+1);
scanf("%f",&withdrawals[i]);
while(withdrawals[i]>bal)
{
printf(" ***withdrawl amount exceeds the current balance.***");
printf(" Enter the lower amount of withdrawl#%d: ",i+1);
scanf("%f",&withdrawals[i]);
}
bal=bal-withdrawals[i];
if(bal==0)
{
printf(" your balance is zero");
printf(" ***No more withdrawals should be made.***");
exit(0);
}
}

printf(" ***The Closing balance %s is $%.2f *** ",name,bal);
if(bal>=50000.00)
printf(" *** %s it is time to invest some money!*** ",name);
else if(bal>=15000.00 && bal<=49999.99)
printf(" *** %s may be you should consider a CD!*** ",name);
else if(bal>=1000.00 && bal<=14999.99)
printf(" *** %s keep up the good work!*** ",name);
else
printf(" *** %s your balance is getting low!*** ",name);

printf(" ***Bank Record*** ");
printf("Starting Balance:$%.2f ",stbal);

for(i=0;i<nd;i++)
printf("Deposit #%d: %.2f ",i+1,deposits[i]);
printf(" ");
for(i=0;i<nw;i++)
printf("Withdrawal #%d: %.2f ",i+1,withdrawals[i]);
printf(" ");
printf(" Ending Balance: $%.2f",bal);
return 0;
}

Explanation / Answer

printf(" Please enter your first name: ");

// after this line add this line

scanf("%s",name);