Please Help me to bubble sort of a String array.

Why you want to do that? Just use the Sort method of the array.

for (int pass = 1; pass <= wordsArray.Length; pass++)
    {
        for (int j = 0; j <= wordsArray.Length - 2; j++)
        {
           [B] if (wordsArray[j] > wordsArray[j + 1])[/B]    i find the error over this line.. .logical error i think please help me      
                {
                string Swap; 
                Swap = wordsArray[j];
                wordsArray[j] = wordsArray[j + 1];
                wordsArray[j + 1] = Swap;
            }
        }
    }

The string class has no overloaded > operator. Use a Compare method of the string class for that.
EDIT: You can only use == and != operators in an if statement when comparing strings.

Hi

string[] wordsArray = { "a", "bb", "ccc", "d", "ee", "f", "ggg" };
            for (int pass = 0; pass < wordsArray.Length; pass++)
            {
                for (int j = 0; j <= wordsArray.Length - 2; j++)
                {
                    if (wordsArray[j] > wordsArray[j + 1]) //when you come the last character of the array index [j+1] will throw an error - becuase its out of bounds!!
                    {
                        string Swap;
                        Swap = wordsArray[j];
                        wordsArray[j] = wordsArray[j + 1];
                        wordsArray[j + 1] = Swap;
                    }
                }
            }

What exactly would you like to do here?

Why you want to do that? Just use the Sort method of the array.

One word: Homework

commented: Guess I was in outer space, thanks for bringing me back. :) +14

hi

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.