A string is input which is both in uppercase & lowercase letters. How can I arrange the string so that all lowercase letters are in one side and uppercase letters are in another side.

For basic ASCII which I presume you will be using, then you can just check the character range. and swap accordingly. IE, 65-90 is capital etc

Chris

A string is input which is both in uppercase & lowercase letters. How can I arrange the string so that all lowercase letters are in one side and uppercase letters are in another side.

Upper case characters have the ascii value starting from 65-90 and the lower case characters have the ascii value starting from 97-122.

So i can compare the characters using ascii value and then arrange as you require.

I know we have to swap letters according to ASCII code. But is it possible to arrange it one array? Or the result may come in another array?

You can do it in one array

char array[3] = {'a', 'C', 'b'};
char temp;
temp = array[2];
array[2] = array[1];
array[1] = temp;

Chris

I know we have to swap letters according to ASCII code. But is it possible to arrange it one array? Or the result may come in another array?

yes it is possible to arrange in one array .

yes it is possible to arrange in one array .

Do you feel the need to echo me?

Do you feel the need to echo me?

It is not uncommon for two people to post about the same solution or idea, without knowing or being aware of each other, since the browser doesn't refresh until the post has been committed.

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.