C Program String Concatenation using strcat

C Program String Concatenation using strcat /* C program to input two strings and concatenating the second string at end of first string using strcat() predefined string function. */ #include <stdio.h> #include <string.h> int main() { char str1[100], str2[100]; printf("Enter the first string\n"); gets(str1); printf("Enter the second string\n"); gets(str2); strcat(str1, str2); printf("String obtained after concatenation\nusing… Read More »

Loading

C Program Case Insensitive String Comparison

C Program Case Insensitive String Comparison USING stricmp() built-in string function /* C program to input two strings and check whether both strings are the same (equal) or not using stricmp() predefined function. stricmp() gives a case insensitive comparison. www.easycodebook.com */ #include <stdio.h> #include <string.h> int main() { char str1[100], str2[100]; printf(“Enter first string for… Read More »

Loading

C Program Compare String using strcmp

C Program Compare String using strcmp /* C program to input two strings and check whether both strings are the same (equal) or not using strcmp() predefined function. strcmp() gives a case sensitive comparison. www.easycodebook.com */ #include <stdio.h> #include <string.h> int main() { char str1[100], str2[100]; printf(“Enter first string\n”); gets(str1); printf(“Enter second string\n”); gets(str2); if… Read More »

Loading

C Program String Reverse Using strrev

C Program String Reverse Using strrev /* C Program Reverse a string using strrev() predefined function www.easycodebook.com */ #include <stdio.h> #include <string.h> int main() { char str[100]; printf("Please, Enter a string to reverse\n"); gets(str); strrev(str); printf("The Reverse string is : %s\n", str); return 0; } Output Please, Enter a string to reverse ABCDEF The Reverse… Read More »

Loading

C Program Convert String Upper Case

C Program Convert String Upper Case /* C Program to convert given string into lower case */ #include <stdio.h> #include <string.h> int main() { char str[100]; printf(“Please, input a string to convert to lower case\n”); gets(str); printf(“The string in lower case is: %s\n”, strlwr(str)); return 0; } Output Please, input a string to convert to… Read More »

Loading

C Program Convert String Lower Case

C Program Convert String Lower Case /* C Program to convert given string into lower case */ #include <stdio.h> #include <string.h> int main() { char str[100]; printf(“Please, input a string to convert to lower case\n”); gets(str); printf(“The string in lower case is: %s\n”, strlwr(str)); return 0; } Output Please, input a string to convert to… Read More »

Loading

C Program Find String Length

C Program Find String Length /* C program to calculate and print length of given string without using built-in function. */ #include<stdio.h> #include<string.h> int main() { int i,length; char str[100]; printf("Enter a String to find its length:"); gets(str); i=0; while(str[i]!='\0') i++; printf("Using own code, The length of string '%s' is = %d",str,i); printf("\nUsing Predefined Function… Read More »

Loading