-
Notifications
You must be signed in to change notification settings - Fork 0
/
String_operations.c
61 lines (42 loc) · 1.17 KB
/
String_operations.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#include <stdio.h>
#include <conio.h>
#include <string.h>//use of strings functions
int main()
{
char a[8] ="Samarth";
char b[8] =" Alok ";
char c[12] ="Srivastava";
char d[100];
char e[100];
strcat(a,b);
strcat(a,c);
strcpy(d,a);
printf("Enter My full name (first letters in upper case) :");
gets(e);
int res = strcmp(a,e);
if (res==0)
printf("Correct");
else
printf("No It's not %s, its %s",e,d );
printf("\nMy name is %s \n \n",d);
printf("The length of my name is %d letters ", strlen(d));
strupr(d);
printf("\n\n%s",d);
strlwr(d);
printf("\n\n%s",d);
strrev(d);
strupr(d);
printf("\n\n%s",d);
getch();
return 0;
}
/*
To safely and conveniently operate with strings, you can use the Standard Library string functions shown below. Don't forget to include <string.h>.
#strlen() - get length of a string //21
#strcat() - merge two strings//13,15
#strcpy() - copy one string to another//17
#strlwr() - convert string to lower case//27
#strupr() - conver string to upper case//23,31
#strrev() - reverse string//30
strcmp() - compare two strings//-
*/