If there is a structure:
struct Student // Student structure to store student's records
{
int rollno; // student rollno
string name; // student name
string address; // address
int pno; // phone number
};
and int main() contains
int main()
{
Student *s;
s= new Student [10];
}
Then how can we assign a struct to a different struct of same types?
void arrange()
{
Student *p= new Student;
// int temp;
for (int i=0; i<10; i++)
{
for (int j=0; j<10; j++)
{
if (i != j)
{
if (s[i].rollno > s[j].rollno)
{
p = s[i];
s[i] = s[j];
s[j] = p;
}
}
}
}
*p = s[i];ands[j] = *p;to make assignments to/fromp.main()and you try to use it inarrange().