arshesander
Jan 2nd, 2010, 01:51 PM
#include<iostream.h>
#include<conio.h>
static const char*brothers[]={
"Frederick William",
"Joseph Jensen",
"Harry Alan",
"Walter Ellsworth",
"Julian Paul"
};
extern "C" void SortCharArray(const char**);
extern"C"{
int SizeArray(void)
{
return sizeof brothers/sizeof(char*);
}
}
#define SortCharArray;
main()
{
clrscr();
SortCharArray(brothers);
int size=SizeArray();
for(char i=0; i<size; i++)
cout<<'\n'<< brothers[i];
getche();
}
The code was not able to sort the given names from the array. How can I modify the program so that it will sort the given names?
#include<conio.h>
static const char*brothers[]={
"Frederick William",
"Joseph Jensen",
"Harry Alan",
"Walter Ellsworth",
"Julian Paul"
};
extern "C" void SortCharArray(const char**);
extern"C"{
int SizeArray(void)
{
return sizeof brothers/sizeof(char*);
}
}
#define SortCharArray;
main()
{
clrscr();
SortCharArray(brothers);
int size=SizeArray();
for(char i=0; i<size; i++)
cout<<'\n'<< brothers[i];
getche();
}
The code was not able to sort the given names from the array. How can I modify the program so that it will sort the given names?