C Program to Count - Vowels,Spaces,Words,Characters,Digits
C Programs : String Operations Without using Library Function
C Program for sorting the list of Strings
Suppose you are having the list of strings then we are sorting all the strings in descending and ascending order.
C Program to Find Length of the String using Pointer
Program to Calculate Length of the String using Pointer Write a C Program which will accept string from the user . Pass this string to the function. Calculate the length of the string using pointer. Program : Length of the String using Pointer #include<stdio.h> #include<conio.h> int string_ln(char*); void main() { char str[20]; int l; clrscr();(…)
Write a C Program to Reverse Letter in Each Word of the Entered String
Write a C Program to Reverse Letter in Each Word of the Entered String In this program we are going to accept a string . This program will check for word inside string and if word founds then program will reverse that word. Similarly it will reverse out all all the words. #include<stdio.h> #include<conio.h> #include<string.h>(…)
C Program to Encode a String and Display Encoded String !
Problem Statement : Read a five-letter word into the computer, then encode the word on a letter-by-letter basis by subtracting 30 from the numerical value that is used to represent each letter. Thus if the ASCII character set is being used, the letter a (which is represented by the value 97) would become a C(…)
C program to Delete all occurrences of Character from the String.
Program : Delete all occurrences of Character from the String #include<stdio.h> #include<conio.h> #include<string.h> void del(char str[],char ch); void main() { char str[10]; char ch; clrscr(); printf(“\nEnter the string : “); gets(str); printf(“\nEnter character which you want to delete : “); scanf(“%ch”,&ch); del(str,ch); getch(); } void del(char str[],char ch) { int i,j=0; int size; char ch1;(…)
C Program to Concat Two Strings without Using Library Function
Program : C Program to Concat Two Strings without Using Library Function #include<stdio.h> #include<string.h> void concat(char[],char[]); void main() { char s1[50],s2[30]; printf(“n Enter two strings :”); gets(s1); gets(s2); concat(s1,s2); printf(“nConcated string is :%s”,s1); getch(); } void concat(char s1[],char s2[]) { int i,j; i=strlen(s1); for(j=0;s2[j]!=’\0′;i++,j++) s1[i]=s2[j]; s1[i]=’\0′; } Output : Enter two strings : c4learn. com(…)
C Program to Find Substring Of String Without Using Library Function !!!
Program : C Program to find substring #include<stdio.h> #include<string.h> int search(char[],char[]); void main() { char a[100],b[40]; int loc; printf(“\n Enter the main string :”); gets(a); printf(“\n Enter the search string :”); gets(b); loc = search(a,b); if(loc==-1) printf(“\nNot found”); else printf(“\nFound at location %d”,loc+1); getch(); } int search(char a[],char b[]) { int i,j,k; i=0,j=0; while(a[i]!=’\0′) {(…)
C Program : Reverse String Without Using Library Function [ Strrev ]
Program : Reverse String Without Using Library Function [ Strrev ] #include<stdio.h> #include<string.h> void main() { char s[100],temp; int i,j=0; printf(“n Enter the string :”); gets(s); i=0; j=strlen(s)-1; while(i<j) { temp=s[i]; s[i]=s[j]; s[j]=temp; i++; j-; } printf(“nReverse string is :%s”,s); getch(); } Animation : Incoming search terms:c program to reverse a string without using library(…)
C Program to Compare Two Strings Without Using Library Function [Strcmp]
C Program to Compare Two Strings Without Using Library Function #include<stdio.h> #include<conio.h> void main() { char str1[30],str2[30]; int i; printf(“\n Enter two strings :”); gets(str1); gets(str2); //loop for comparison i=0; while(str1[i]==str2[i] && str1[i]!=’\0′) i++; if(str1[i] > str2[i]) printf(“\nstr1 > str2″); else if(str1[i] < str2[i]) printf(“\nstr1 < str2″); else printf(“\nstr1 = str2″); getch(); } Incoming search(…)