Filling 4 variable in a struct type and using malloc
I need to write a simple program that ask the user to insert 4 double type variable in a struct variable data.

       struct Data  
        {
          double a;
          double b;
          double c;
          double average;
        };
    struct Data *ptr_name;
    int i;

First, ask user the size:

     printf("Please enter the size:");
     scanf("%d", &size);

Then, use the malloc. (I dont know how to use it...)

something like this... `ptr_name = ()malloc();`

and then use the for loop to get the a, b, c from user.

    for(i = 0; i < size; i++)
    {
     //dont know how to put the staement..
    }


finally, print everything out, including the average.

    for(i = 0; i < size; i++)
        {
         //same as above...
        }



That is pretty much all, I am learning struct type and malloc now, can't understand by browsing web...  help, thanks.
Filling 4 variable in a struct type and using malloc
===

I need to write a simple program that ask the user to insert 4 double type variable in a struct variable data.

       struct Data  
        {
          double a;
          double b;
          double c;
          double average;
        };
    struct Data *ptr_name;
    int i;

First, ask user the size:

     printf("Please enter the size:");
     scanf("%d", &size);

Then, use the malloc. (I dont know how to use it...)

something like this... `ptr_name = ()malloc();`

and then use the for loop to get the a, b, c from user.

    for(i = 0; i < size; i++)
    {
     //dont know how to put the staement..
    }


finally, print everything out, including the average.

    for(i = 0; i < size; i++)
        {
         //same as above...
        }



That is pretty much all, I am learning struct type and malloc now, can't understand by browsing web...  help, thanks.