For starters according to the C Standard the function main without parameters shall be declared like
int main( void )
You declared an array of three pointers but the elements of the array are not initialized and have indeterminate values.
As a result calling the function scanf in this loop
for(i=0;i<=2;i++){
scanf("%f",coefficient[i]);
}
invokes undefined behavior.
The pointers which are elements of the array shall point to a valid memory where data may be stored using the pointers.
For example you can for each pointer dynamically allocate memory that will be pointed to by the corresponding pointer
Here is a demonstrative program.
#include <stdio.h>
#include <stdlib.h>
int main(void)
{
enum { N = 3 };
float *coefficient[N];
for ( size_t i = 0; i < N; i++ )
{
coefficient[i] = malloc( sizeof( float ) );
}
for ( size_t i = 0; i < N; i++ )
{
scanf( "%f", coefficient[i] );
}
for ( size_t i = 0; i < N; i++ )
{
printf( "%f\n", *coefficient[i] );
}
for ( size_t i = 0; i < N; i++ )
{
free( coefficient[i] );
}
return 0;
}
If to enter
1.1
2.2
3.3
then the output will look like
1.100000
2.200000
3.300000
You can format the output as you like.
In general you should check that a call of malloc and/or of scanf was successful.
coefficientis already essentially a pointer. Try declaringfloat coefficient[3];instead offloat *coefficient[3]*in theprintf, and change thescanftoscanf("%f", &coefficient[i]);to match. I suspect they declared a pointer array solely because they didn't understand how you're supposed to pass arguments toscanf(using&to get the address of an existing stack variable typically).