Search
 
SCRIPT & CODE EXAMPLE
 

C

finding average of elements in array using struct in C?


typedef struct Student{
    int student_marks;
    int Rno;
    char name[40];


} st;


int average(struct Student ptr[], int n);

int main(){
    //int marks[10];

    struct Student st[20];
    // = {{154, 12,"john"}, {212, 43, "Mike"}, {124,53,"James"}};
    for (int j = 0; j < 20; ++j){
        scanf("%s %d %d", st.name, st.Rno, st.student_marks)
    }
    printf("Student Average is : %d
", average(s,3));

    return 0;
}



int average(struct Student *ptr, int n){
     int sum = 0, agf, n;

    //int len = sizeof(mr)/sizeof(mr[0]);
    for (int i = 0; i <= 3; i++){
        sum += ptr[i];
    }

    agf = sum / n;

}
Comment

PREVIOUS NEXT
Code Example
C :: c++ sum of ascii string 
C :: navigate to line intellij 
C :: A string S is passed as the input. Two words W1 and W2 which are present in the string S are also passed as the input. The program must find the minimum distance D between W1 and W2 in S (in forward or reverse order) and print D as the output. 
C :: Program optimization 
C :: programmation c 
C :: params in main function in C 
C :: nosql injection 
C :: Typecast Operator in C language 
C :: how to get value of multidimensional array in c 
C :: fibonacchi series in c 
C :: how to do add to an integrr in c 
C :: docker logs follow 
Dart :: flutter sleep 
Dart :: ElevatedButton flutter style 
Dart :: flutter appbar text color 
Dart :: flutter textfield outlineinputborder 
Dart :: flutter card border radius overflow hidden 
Dart :: options = null firebaseoptions cannot be null when creating the default app. flutter 
Dart :: target of uri doesn 
Dart :: File dart get file extension 
Dart :: increase text size of Test flutter 
Dart :: to disable the shrinker pass the --no-shrink flag to this command. in flutter 
Dart :: dart list to json 
Dart :: flutter column vertical direction 
Dart :: text field validation in flutter 
Dart :: dart qoldiqni olish 
Dart :: flutter flat button size 
Dart :: transparent appbar flutter 
Dart :: raisedbutton full width flutter 
Dart :: flutter int max value 
ADD CONTENT
Topic
Content
Source link
Name
4+5 =