boost learn study
Showing posts with label
String
.
Show all posts
Showing posts with label
String
.
Show all posts
Friday, March 28, 2014
strrev() - String Handling Functions
/*Write a program to print the reverse String*/ #include
#include
#include
void main() { char name[20]; clrscr(); printf("Enter the Name:\n"); scanf("%s",name); strrev(name); printf("\n Reverse String=%d",name getch(); }
Output is as :
Enter the Name
Laura
aruaL
Read more �
strlen() - String Handling Functions
/*Write a program to print the length of String*/ #include
#include
#include
void main() { char name[20]; int len=0; clrscr(); printf("Enter the Name:\n"); scanf("%s",name); len = strlen(name); printf("\n Length of String=%d",len getch(); }
Output is as :
Enter the Name
Laura
Length of String=5
Read more �
strcpy() - String Handling Functions
/*Write a program to copy one string into another string*/ #include
#include
#include
void main() { char name1[20], name2[10]; clrscr(); printf("Enter the two Names:\n"); scanf("%s%s",name1,name2); i = strcpy(name1,name2); printf("\n Copy String=%s",name1 getch(); }
Output is as :
Enter the two Names
Bintu
Chaudhary
Bintu Chaudhary
Read more �
stcmp() - String Handling Functions
/*Write a program to compare two string*/ #include
#include
#include
void main() { char name1[10], name2[10]; int i=0; clrscr(); printf("Enter the two Names:\n"); scanf("%s%s",name1,name2); i = strcmp(name1,name2); if(i==0) { printf("Both String are equal"); } else { printf("Both String are not equal"); } getch(); }
Output is as :
Enter the two Names
Bintu
Chaudhary
Both String are not equal
Read more �
stcat() - String Handling Functions
/*Write a program to concatenate two string*/ #include
#include
#include
void main() { char name1[10], name2[10]; clrscr(); printf("Enter the two Names:\n"); scanf("%s%s",name1,name2); strcat(name1,name2); printf("%s",name1); getch(); }
Output is as :
Enter the two Names
Bintu
Chaudhary
BintuChaudhary
Read more �
Older Posts
Home
Subscribe to:
Posts (Atom)