Theory
Write a C program to copy one string to another string.
#include
#define MAX_SIZE 100 // Maximum size of the string
int main()
{
char text[MAX_SIZE]; /* Declares a string of size 100 */
int i;
int count= 0;
/* Input a string from user */
printf("Enter any string: ");
gets(text);
/* Iterate till the last character of string */
for(i=0; text[i]!='\0'; i++)
{
count++;
}
printf("Length of '%s' = %d", text, count);
return 0;
}/**
* C program to find length of a string using pointer
*/
#include
#define MAX_SIZE 100 // Maximum size of the string
int main()
{
char text[MAX_SIZE]; /* Declares a string of size 100 */
char * str = text; /* Declare pointer that points to text */
int count = 0;
/* Input.... Show MoreFrom Strings in C programming · C programming
Write a C program to copy one string to another string.
Write a C program to count occurrences of a word in a given string.
Write a C program to find total number of vowels and consonants in a string.
Write a C program to concatenate two strings.
Write a program in C to find the largest and smallest word in a string.
Write a C program to find maximum occurring character in a string.
Write a C program to search all occurrences of a character in a string.
Write a C program to compare two strings