#include <stdio.h>
#include <conio.h>
#include <alloc.h>
#include <string.h>
#define S 4
main()
{
char*arr_str[S];
char temp[20];
int i, n, len;
clrscr();
for( i = 0; i < S; i++ )
{
printf(" Enter a string %d\n ", i + 1);
gets( temp );
len = strlen( temp );
arr_str[i] = (char*)malloc(len);
strcpy(arr_str[i], temp);
}
printf(" The entered strings are\n ");
for(i = 0; i < S; i++)
printf(" %s\n ", arr_str[i]);
getch();
return 0;
}
OUTPUT:
Enter a string 1
Do or Die
Enter a string 2
Love is life
Enter a string 3
Live and let live
Enter a string 4
Work is worship
The entered strings are
Do or Die
Love is life
Live and let live
Work is worship
ALSO READ:
-- Program to accept a string and print it by using the while loop.
-- Program to accept a string in upper case and print it in lower case.
-- Program to accept a string in any case and print it by another case.
-- Program to accept a string and print each word in new line.
-- Program to accept a string and count no of capital letters, no. of small letters and no. of special characters.
-- Program to accept a string and find the length of the given string by using functions.
-- Program to accept a string and print the reverse of the given string.
-- Program to accept a string and check whether the given string is palindrome or not.
-- Program to accept two string and compare the strings are equal or not.
-- Program To Find Out The No. Of Times A Character Is Present In The String.
-- Program To Accept A String & Find Out Whether This Character Is Present In The String.
-- Program To Accept A String & Display Number Of Each Vowels.
-- Program To Accept A String & Display Number Of Vowels.
-- Program To Accept A String & Display Vowels.
-- Program To Accept Two Strings & Display Combination Of Two Strings.
-- Program To Accept Two Strings & Display The Largest String.
-- Program To Accept A String & Display It's Alternate Characters In Reverse.
-- Program To Accept A String & Display It's Substring.
-- Program To Accept A String & Display Alternate Characters In Either Case.
-- Program To Accept A String & Display Its Alternate Characters.
-- Program To Accept A String & Display In Reverse.
-- Program To Accept A String & Display It.
-- Program On Strings Into Array Of Pointers.
-- Program To Concatenate Two Strings.
-- Program To Compare Two Strings.
... Back To C Program Index.
Comments
Post a Comment
Please share your opinions and suggestions or your experience in the comments section. This way we can all help each other...
Experienced guys can share their resumes at admin@interview-made-easy.com