I used structure for multiple entry of students. But I am getting error in the following code:
#include <iostream>
using namespace std;
struct Student{
   char stuName[30];
   int stuRollNo;
   int stuAge;
};
void printStudentInfo(struct Student s[]);
int main(){
    int i;
    for(i=0;i<3;i++){
   Student s[i];
   cout<<"Enter Student Name: ";
   cin.getline(s[i].stuName, 30);
   cout<<"Enter Student Roll No: ";
   cin>>s[i].stuRollNo;
   cout<<"Enter Student Age: ";
   cin>>s[i].stuAge;
   printStudentInfo(s[i]);}
   return 0;
}
void printStudentInfo(struct Student s[i]){
   cout<<"Student Record:"<<endl;
   cout<<"Name: "<<s[i].stuName<<endl;
   cout<<"Roll No: "<<s[i].stuRollNo<<endl;
   cout<<"Age: "<<s[i].stuAge;
}
error:
main.cpp:29:25: error: cannot convert ‘Student’ to ‘Student*’ for argument ‘1’ to ‘void printStudentInfo(Student*)’
    printStudentInfo(s[i]);} 
                         ^
main.cpp: At global scope:
main.cpp:33:40: error: ‘i’ was not declared in this scope
 void printStudentInfo(struct Student s[i]){ 
                                        ^
main.cpp: In function ‘void printStudentInfo(...)’:
main.cpp:35:20: error: ‘s’ was not declared in this scope
    cout<<"Name: "<<s[i].stuName<<endl; 
                    ^
main.cpp:35:22: error: ‘i’ was not declared in this scope
    cout<<"Name: "<<s[i].stuName<<endl;
I get the point that I need to define i in the function but how will it take values accordingly. If i take a for loop in the function the values will get printed more than the time required. If i do not take an array it will give a segmentation fault.
Please help me with this code. I am new to c++.
 
     
    