My online class just started into arrays, and I am getting this nasty error "passing arg 1 of `show_costs' makes pointer with integer without cast".

I have no idea what the problem is. If anyone would be so kinda, please help.

BTW: sorry, I have a habit of naming my variable an assortment of oddies.

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

#define COMPANY "Sierra Sporting Goods"
#define mnum 1          /*Defining constants*/
#define maxnum 9999
#define mtype 1
#define maxtype 5
#define minquan 1
#define maxquan 50
#define mincost 5.00
#define maxcost 900.00
#define minprice 6.00
#define maxprice 100.00
#define sports 5

int menu(void);
void add(void);                    
double getreal(char word[], double min, double max);
int getint(char stuff[], int min, int max);
double total(int quan, double cos);
double show(int num, int quan, double cost, double price);
int quit(void);
void error(double min, double max);
void clearer(void);
double init_costs(int n[], int c);
double show_costs(int n[], double c);

AREA WITH THE ERROR:

/*===============================================================*/
void add()
{
     int vala, valb, valc, log, bog=5;
	 char alakazam;
     double vald, valf;
     clearer();
     do
       {
       init_costs(0, bog);
       vala = getint("Product Number", mnum, maxnum);
       valb = getint("Product Type", mtype, maxtype);
       valc = getint("Quantity", minquan, maxquan);
       for(log = 0; log < bog; log++) show_costs(log, vald);
       {
       vald = getreal("Cost", mincost, maxcost);
       }
       valf = getreal("Price", minprice, maxprice);
       show(vala, valc, vald, valf);
       printf("Again? (Y/N)");
       scanf("%c%*c", &alakazam);
       }
  
  while(alakazam == 'Y' || alakazam == 'y');
  return;
}
/*======================================================*/
/*====================================================================*/
double show_costs(int n[], double c)
{
       int scrub;
       if(n[] < 5)
       {
           n[scrub] == c;
           scrub++;
       }
       else
       {
           printf("Type-------------------------Cost");
           printf("1:---------------------------%lf", n[0];
           printf("2:---------------------------%lf", n[1];
           printf("3:---------------------------%lf", n[2];
           printf("4:---------------------------%lf", n[3];
           printf("5:---------------------------%lf", n[4];
       }
       return 0;
}
       
       
/*===========================================*/

double show_costs(int n[], double c); first parameter is an array of integers

show_costs(log, vald); log is not an array of integers.

if(n[] < 5) incorrect syntax, there must be a subscript inside the []

In your show_costs() function ...

int scrub;
if(n[some_valid_subscript_here] < 5)
{
    // what is the value of [B]scrub[/B] here?
    //  and where does it come from??
    n[scrub] == c;  
    scrub++;
}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.