i have an array which contains third level pointers :

char * arrP1 [ ] = { "father", "mother", NULL},
	                     * arrP2 [ ] = { "sister", "brother", "grandfather", NULL }, 
                       * arrP3 [ ] = { "grandmother", NULL},
                       * arrP4 [ ] = { "uncle", "aunt", NULL };
	               char ** arrPP [ ] = { arrP1, arrP2, arrP3, arrP4 , NULL};

what is the best way to sort all strings in arrPP in lexicographical order
so i can print them all in this order.

if it helps i can sort each *arr[] seperatly

Recommended Answers

All 4 Replies

Destructively or non-destructively?

Why do you have so much indirection?

>>what is the best way to sort all strings in arrPP
Declare them all in one big array and in sorted order then you won't have to worry about that.

ok thanks

Did you just give up or did AD's suggestion help solve your problem?

I've had occasion to arrange an array of pointers to string just like you are, which is fine, but without a better idea of what you are trying to do with all the indirection it is hard to help you.

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.