0
void maximum(double *max, double x[])
{
int i;

for( i = 0; i<100; i++)
{
if(max < x[i])
max=x[i];
}
}

Why isnt this working
Im probrably missing one syntaz that i cant think of at the moment

Thank u

Edited by TinhornAdeniyi: n/a

3
Contributors
4
Replies
6
Views
6 Years
Discussion Span
Last Post by TinhornAdeniyi
0

When you say double *max, the variable max contains the address. To print the value you have to write *max .

PS I hope you have malloced memory for max

int main();
{
    int x =10;
    int *p = &x;

   printf("%d\n",*p);           // This gives 10
   printf("%u\n",p);            // This gives an address

   return 0;
}

Edited by abhimanipal: n/a

0

PS I hope you have malloced memory for max

Why? Can't you just create the variable using double max; and pass in the address?

0

Thanks
i did this

void Grades (int *Acounter,int *Bcounter,int *Ccounter,int *Dcounter,int *Ecounter, double x[])
{

int A=0,B=0,C=0,D=0,E=0;
int i;
for(i = 0; i<100 ; i++)
{
if(x[i] >= 90 && x[i] <= 100)
A++;
else if (x[i] >= 80 && x[i] <= 90)
B++;
else if (x[i] >= 70 && x[i] <= 80)
C++;
else if (x[i] >= 60 && x[i] <= 70)
D++;
else if (x[i]<60)
E++;
}
*Acounter = A;
*Bcounter = B;
*Ccounter = C;
*Dcounter = D;
*Ecounter = E;
}

Thanks again

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.