#include<iostream>
#include<string.h>
#include<conio.h>
using namespace std;
int main()
{
char name[30][50];
char aux[50];
int n,ok;
cout<<"number of pupils : ";
cin>>n;
for(int i=0;i<n;i++)
{
cout<<"name : ";
cin>>name[i];
}
do
{
ok=0;
for(int i=0;i<n-1;i++)
{
if(strcmp(name[i],name[i+1])>0)
{
aux=name[i+1]; // here is the bug
name[i+1]=name[i];
name[i]=aux;
ok=1;
}
}
}while(ok==1);
for(int i=0;i<n;i++)
{
cout<<name[i]<<endl;
}
}
I know it is a noob question, but I am grateful for your help. How can I assign a char[][] to a char[] ? this error occurs 3 times in my code and I do not have enough knowledge to figure it out why