The code is working as I want it to. I am supposed to use pointer syntax, and this seems to me working.

I just wanted to run it past some of the people who know what they're doing first.

/*===============================================================*/
void add()
{
     int vala, valb, valc, count=0, bog = 5;
	 char alakazam, supah[maxstr];
     double log[5], vald, valf;
     init_costs(log, bog);
     clearer();
     do
       {
                 {
                 vala = getint("Product Number", mnum, maxnum);
                 clearer();
                 valb = getint("Product Type", mtype, maxtype);
                 clearer();
                 valc = getint("Quantity", minquan, maxquan);
                 getstring(supah, supah);
                 clearer();
                 vald = getreal("Cost", mincost, maxcost);
                 clearer();
                 log[valb-1] += vald * valc;
                 valf = getreal("Price", minprice, maxprice);
                 clearer();
                 show(vala, valc, vald, valf, supah);
                  }
       show_costs(log, vald, count);
       printf("Again? (Y/N)");
       scanf("%c%*c", &alakazam);
       }
  
  while(alakazam == 'Y' || alakazam == 'y');
  return;
}
/*====================================================================*/
double getreal(char word[], double min, double max)
{
   int err;
   double value;
do
   {
   printf("\nEnter %s between %.0lf and %.0lf: ", word, min, max);
   scanf("%lf%*c", &value);
   err = (value < min) || (value > max);
   if (err) error(min, max);
   }
while (err);
return (value);
}
/*===========================================================*/
double init_costs(double *po, int c)
{
               int i;
               for(i=0; i < c; i++);
               {
                        *(po + i) = 0;
               }
               return 0;
}
/*====================================================================*/
double show_costs(double *poi, double molah, int count)
{
           int *mn;
           double *molahpnt;
           molahpnt = &molah;
           mn = &count;
           printf("\n\n\nType-------------------------Cost\n");
                  *(poi + *mn);
                  printf("%d:---------------------------%lf\n", *mn, *molahpnt);
                  *mn++;
       return 0;
}
       
       
/*====================================================================*/

By the way, one thing I am having a problem with is with show_costs();. When I run the script of this, I want it's output to look like:

Type----------------Cost
0--------------------/*input prices*/
1--------------------/*input prices*/ /*I want this to show even when nothing has been input*/
2--------------------/*input prices*//*I want this to show even when nothing has been input*/
3--------------------/*input prices*//*I want this to show even when nothing has been input*/
4--------------------/*input prices*//*I want this to show even when nothing has been input*/

But I get:

Type-----------------------Cost
0---------------------------/*Input price*/

Every time I run it. What can I do to fix that?

double show_costs(double *poi, double molah, int count)
Shouldn't that be void since you are returning 0?

int *mn;, double *molahpnt;
I understand you want to play with pointers, however those are not necessary.
double molah and int count could have been passed as pointers as well instead as a copy of the value.

*(poi + *mn);
No side effect with this statement. It does nothing.

printf("%d:---------------------------%lf\n", *mn, *molahpnt);
Drop the l. That's undefined behavior except for C99

>Every time I run it. What can I do to fix that?
Haven't look at any other part of your code. Nevertheless, you are missing a loop somewhere that will keep displaying molah and count until you are happy.

Dear Gerrit,

I just looked at the link posted by Chandrashekhar1.... let me save you some time.

What he posted is pure crap. It's largely incomprehensible, and likely rife with errors. don't waste your time downloading it.

go instead to any one of a number of credible and freely available tutorials/examples on C programming.

like this one, written by a professor at MIT, designed for the beginning programmer:

http://pdos.csail.mit.edu/6.828/2007/readings/pointers.pdf

or any of a hundred others.

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.