Smart Lab Helping Forum

Members Login
Username 
 
Password 
    Remember Me  
Post Info TOPIC: how to call funtion,in calling function i have error


Newbie

Status: Offline
Posts: 2
Date:
how to call funtion,in calling function i have error
Permalink  
 


#include <stdio.h>
#define size 7
int i;
int marks[7];
void GPAsystem(char gpa[7]);
int main()
{char GPA[7]={'A','B','b','C','c','D','F'};
char subject[]="  3crdtsub1, 3crdtsub2, 3crdtsub3, 3crdtsub4, 2crdtsub1, 2crdtsub2, 2crdtsub3";
printf("%s\nInput numbers according to above sequence\n", subject);
for(i=0;i<7;i++)
{ scanf("%d", &marks);
}
printf("\n%s\n", subject);
for(i=0;i<7;i++)
{printf("%10d" ,marks);
}
printf("\n");
GPAsystem(GPA);
for(i=0;i<7;i++){
    printf("%10c", GPA);}
}
void GPAsystem(char gpa[7])
{
for(i=0;i<7;i++)
{if (marks>90)
{marks=gpa[0];}
else if (80<marks<90)
{marks=gpa[1];}
else if (70<marks<80)
{marks=gpa[2];}
else if (60<marks<70)
{marks=gpa[3];}
else if (50<marks<60)
{marks=gpa[4];}
else if (40<marks<50)
{marks=gpa[5];}
else if (marks<40)
{marks=gpa[6];}
}
}

Sir it dors not call funtion and GPA[7] is printed as it is..........

And sir i wrote GPAsystem(GPA, 7); to call funtion but it gives an error of " GPAsystem cnt have two arguements" but when I wrote GPAsystem(GPA); it does not give error............

I cnt understand ........

Please tell Thanku



__________________


Veteran Member

Status: Offline
Posts: 39
Date:
Permalink  
 

You have to pass the array by its reference as I believe you want to read every value in gpa array. Pass like this

void GPAsystem (char gpa[])

Shamyl

__________________
Page 1 of 1  sorted by
 
Quick Reply

Please log in to post quick replies.



Create your own FREE Forum
Report Abuse
Powered by ActiveBoard