c - conflicting types for 'topper',brnchwise -


program intake 3 students details , subjects(3) marks ,

  1. display topper

  2. students under branch.

error conflicting types 'topper','brnchwise'.

i've defined functions before using them.

#include <stdio.h> #include <conio.h> #include <string.h> #include <stdlib.h>  struct student {     int regno;     char brnch[3];     int marks[3];     int avg; } s[3];  void mainscrn() {     int o;     char brncho[3];     printf("enter 1. displaying topper details\n\t 2.for display students under branch");     scanf("%d",&o);     switch(o)     {     case 1:         system("cls");         printf("the topper details are:");         topper();         break;      case 2:         system("cls");         printf("enter  brnch");         scanf("%s",&brncho);         system("cls");         brnchwise();         break;     default:         printf("pls enter right option");         mainscrn();         break;     } }  void topper() {     int i,a,count,t=0;     for(i=0;i<3;i++)     {         if(s[i].avg>t)         {             count=i;         }     }     printf("regno:\t %d\nbranch:\t%s",s[count].regno,s[count].regno);     printf("\npress 0 fo main screen");     scanf("%m",&a);     if(a==0)     {         mainscrn();     } }  void brnchwise() {     int a,i;     char brncho[3];     printf("the sudents are: \n");     scanf("%s",&brncho);     for(i=0;i<3;i++)     {         if(strcmp(brncho,s[i].brnch)==0)         {             printf("/n%s",s[i].regno);         }     }     printf("\npress 0 fo main screen");     scanf("%m",&a);     if(a==0)     {         mainscrn();     } }  int main() {     int i,j,t;     for(i=0;i<3;i++)     {         printf("enter detils 1.regno,2.brnch,marks");          t=0;         scanf("%d%s",&s[i].regno,&s[i].brnch);         for(j=0;j<3;j++)         {             scanf("%d",&s[i].marks[j]);             t=t+s[i].marks[j];         }         s[i].avg=t;     }     mainscrn();      return 0; } 

i've defined functions before using them.

actually, haven't. topper , brnchwise referenced in mainscrn, , haven't been defined yet @ point. since these functions reference each other, need add declaration functions:

void topper(void); void brnchwise(void);  void mainscrn(void) {     ... }  void topper(void) {     ... }  void brnchwise(void) {     ... } 

Comments