Tag: Strings

Difference between char [] and char * in C?

Generally, the following two statements about char[] and char * in C are considered confusing and understanding the difference between them is important. The first statement puts the literal string “mycplus” in read-only memory and copies the string to newly allocated memory on the stack. The second statement is known as static string allocation and definition.

Read More

String Sorting in Java

This is a sample Java program to demonstrate string sorting. The function uses a space character as a separator between words. It iterates through each word in the input string and creates a words[] array. Finally it sorts the array of the words in ascending order of the letters i.e. a->z and displays the sorted array by printing one word at each line.

Read More
  • 1
  • 2