I am having problems with pointers and i am getting two errors saying "invalid argument type of 'unary *'"

float getProfit(float* bushels, float price)
{
    int i = 0;
    for(i = 0; i < 20; i++);
    {
        *bushels[i] = *(bushels[i]*price);
    }

    return 0;
}

any ideas on a solution? i have never even seen this error before.

*bushels[i] = *(bushels[i]*price);

The indexing operator already dereferences the pointer, what you're trying to do is dereference a float value, which clearly won't work. Try this instead:

bushels[i] = bushels[i] * price;

Or using the compound operator:

bushels[i] *= price;

ok, now i get a segmentation error just before i call the function. this is my whole code
i am compiling using an ubuntu server

#include<stdio.h>
#include<stdlib.h>

float getProfit(float* bushels[], double price);
float getCosts(float* acres[], float totalAcres, float cost);

int main()
{
    float acres [20];
    float bushels [20];
    float cost;
    double pricePerBushel;
    float totalAcres = 0;
    char choice;
    int count = 0;

    for(count = 0; count < 20; count++)
    {
        acres[count] = 0;
        bushels[count] = 0;
    }

    count = 0;

    printf("\nwould you like to add anouther field:");
    scanf("%c", &choice);
    getchar();

    while(choice != 'n')
    {
        printf("\nEnter the number of acres:");
        scanf("%f", &acres[count]);
        getchar();
        totalAcres += acres[count];

        printf("\nEnter the number of bushels:");
        scanf("%f", &bushels[count]);
        getchar();

        printf("\nwould you like to add anouther field:");
        scanf("%c", &choice);
        getchar();

        if(count == 19)
        {
            printf("\nyou cannot add any more fields");
            choice = 'n';
        }
        count++;
    }   // end of loop

    printf("\nenter total bills:");
    scanf("%f",&cost);
    cost = getCosts(acres, totalAcres, cost );

    printf("\nenter the price per bushel:");
    scanf("%d", &pricePerBushel);
    getProfit(bushels, pricePerBushel);

    int i = 0;

    for(i = 0; i < count; i++)
    {
        bushels[i] = bushels[i]-(acres[i]*cost);
        printf("the profit for the field #%d is %f \n", i,bushels[i]);
    }

    return 0;
}

float getCosts(float* acres[], float totalAcres, float cost)
{
    int i = 0;

    cost= cost/totalAcres;

    return cost;
}

float getProfit(float* bushels[], double price)
{
    float temp = 0;
    int i = 0;
    for(i = 0; i < 20; i++);
    {
            temp = *bushels[i];
            temp = temp * price;
            *bushels[i] = temp;
    }

    return 0;
}

my segmentation error is at line 57, when i am just calling the getProfit() function.
i enter the price and it breaks.

priceperbushel is a double, not an int. Actually, I'd recommend using double everywhere you use float too. You also have a rogue semicolon in getProfit() that's breaking the loop.

Consider this:

#include<stdio.h>
#include<stdlib.h>

double getProfit(double bushels[], double price);
double getCosts(double acres[], double totalAcres, double cost);

int main()
{
    double acres [20];
    double bushels [20];
    double cost;
    double pricePerBushel;
    double totalAcres = 0;
    char choice;
    int count = 0;

    for(count = 0; count < 20; count++)
    {
        acres[count] = 0;
        bushels[count] = 0;
    }

    count = 0;

    printf("\nwould you like to add anouther field:");
    scanf("%c", &choice);
    getchar();

    while(choice != 'n')
    {
        printf("\nEnter the number of acres:");
        scanf("%lf", &acres[count]);
        getchar();
        totalAcres += acres[count];

        printf("\nEnter the number of bushels:");
        scanf("%lf", &bushels[count]);
        getchar();

        printf("\nwould you like to add anouther field:");
        scanf("%c", &choice);
        getchar();

        if(count == 19)
        {
            printf("\nyou cannot add any more fields");
            choice = 'n';
        }
        count++;
    }   // end of loop

    printf("\nenter total bills:");
    scanf("%lf",&cost);
    cost = getCosts(acres, totalAcres, cost );

    printf("\nenter the price per bushel:");
    scanf("%lf", &pricePerBushel);
    getProfit(bushels, pricePerBushel);

    int i = 0;

    for(i = 0; i < count; i++)
    {
        bushels[i] = bushels[i]-(acres[i]*cost);
        printf("the profit for the field #%d is %f \n", i,bushels[i]);
    }

    return 0;
}

double getCosts(double acres[], double totalAcres, double cost)
{
    int i = 0;

    cost= cost/totalAcres;

    return cost;
}

double getProfit(double bushels[], double price)
{
    double temp = 0;
    int i = 0;
    for(i = 0; i < 20; i++)
    {
        temp = bushels[i];
        temp = temp * price;
        bushels[i] = temp;
    }

    return 0;
}

You also have a rogue semicolon in getProfit() that's breaking the loop.

thank you for finding it. i guess ubuntu does not like finding rogue semicolons in the code for you.

*solved

thank you

i guess ubuntu does not like finding rogue semicolons in the code for you.

This is a perfectly legal loop:

for (i = 0; i < 20; i++)
    ;

The compiler shouldn't diagnose it as an error, but can (and likely will) optimize it into this:

i = 20;

By the way, Ubuntu is an operating system, not a compiler. You probably mean GCC.

This question has already been answered. Start a new discussion instead.