| | |
passing arg 1 of `show_costs' makes pointer with integer without cast
Please support our C advertiser: Programming Forums - DaniWeb Sister Site
![]() |
•
•
Join Date: Mar 2008
Posts: 6
Reputation:
Solved Threads: 0
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.
AREA WITH THE ERROR:
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.
C Syntax (Toggle Plain Text)
#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:
C Syntax (Toggle Plain Text)
/*===============================================================*/ 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 []
show_costs(log, vald); log is not an array of integers.
if(n[] < 5) incorrect syntax, there must be a subscript inside the []
"If it moves, tax it. If it keeps moving, regulate it, and if it stops moving, subsidize it" - Ronald Reagan
![]() |
Other Threads in the C Forum
- Previous Thread: lexicographical analysis in c
- Next Thread: trouble with linked list
Views: 1009 | Replies: 2
| Thread Tools | Search this Thread |
Tag cloud for C
* adobe api append array arrays bash binarysearch char character cm copyanyfile copypdffile createcopyoffile createprocess() csyntax directory drawing dynamic executable execv feet fgets file floatingpointvalidation fork frequency function getlogicaldrivestrin givemetehcodez global graphics gtkgcurlcompiling gtkwinlinux highest homework i/o ide infiniteloop initialization interest intmain() iso keyboard kilometer lazy license linked linkedlist linux list lowest matrix meter microsoft mqqueue multi mysql oddnumber odf open openwebfoundation overwrite pause pdf pointer pointers posix power program programming pyramidusingturboccodes read recursion recv recvblocked repetition reversing scheduling segmentationfault send single socketprogramming spoonfeeding stack standard strchr string student suggestions system test testautomation unix urboc user whythiscodecausesegmentationfault win32 win32api windows.h






