I'm wondering why example one of the code doesn't work and example two does. The only change is the repetition of 'float'. The error I get are: unused variable and uninitialized variable. Would just like an explanation so I can fully grasp why it is so. Thank you.
Example one:
#include <stdio.h>
#include <cs50.h>
int main(void)
{
float c;
do
{
printf("Hi! How much change is owed?\n");
float c = get_float();
}
while (float c < 0);
}
Example two:
#include <stdio.h>
#include <cs50.h>
int main(void)
{
float c;
do
{
printf("Hi! How much change is owed?\n");
c = get_float();
}
while (c < 0);
}