#include<
iostream>
using namespace std;
constacode]nt namesize=21;
void getName(char,int);
intmain()
{
int index=5;
int count;
char names[21];
char *aString=names;
for(count=0;count<index;count++)
{
char names;
getName(*aString,index);
cout << "You entered: ";
cout << &names;
 
 
}
}
void getName (char names[][21], int index)
{ 
cout << "enter a name: ";
cin >> names[index];
}

I need to enter five names with 21 charcters

#include<iostream>
usingnamespace std; // seperate "using" and "namespace"
constint namesize=21; // seperate "const" and "int"
void getName(char,int);

void main() // don't use void main -- see my signature for more details

Hope this helps

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.