Array and String
We can consider String as an character array and it can be declared and initialized as follows:
char str = "hello";
C supports an alternative to create a String using Pointer as follows:
char *str = "hello";
str = "hello";
In above declaration str is a character pointer which stores the memory address of first letter of string hello.
We can also point character pointer to character array if we want to take array content at run time from user.
char str, *p;
p = &str; or p=str;
The below program will join or append two strings using pointer and without using string library functions.
Enter String 1: Hello
Enter String 2: How are you
Joined String = HelloHow are you
Thanks for Visit..!