Difference between char [] and char * in C?

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. This statement places the string  “mycplus” in the read-only parts of the memory and making p_name  a pointer to that string.

Comparing strings in C

String library in C, <cstring> or <string.h> provides several functions to manipulate C strings and arrays. The strcmp() function compares two strings. The function returns 0 if both the strings are equal. The standard form of the strcmp() function is: int...

C++ and Object Orientation

Object- Oriented Programming (OOP) is an approach to program organization and development that attempts to eliminate some of the pitfalls of conventional programming methods by in incorporating the best of structured programming features with several powerful new...

C/C++ String Library

The Better String Library is superior to the C library char string type, or C++’s std::string. It’s safer with regard to buffer overflows, simpler than C string manipulation, works ok for ‘\0’ terminated strings and generally faster for common...

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.

The Standard C++ Library: Strings

Standard C++ not only incorporates all the Standard C libraries (with small additions and changes to support type safety), it also adds libraries of its own. These libraries are far more powerful than those in Standard C; the leverage you get from them is analogous to...

Count the characters in a specified string

This is a visual basic 6.0 source code to count the characters in a specified string. This function can be useful in Text editors or where you want to tell the user that how much characters have been inputted in the text field. You can also define which characters to...

Counts the number of words in a specified string

This is a visual basic 6.0 source code that counts the number of words in a specified string. This function can be useful in Text editors or where you want to tell the user that how much words have been inputted in the text field....