include string include stdio include conio int main char s1 10 s2 10 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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
#include <string.h>
#include <stdio.h>
#include <conio.h>
int main()
{
char s1[10],s2[10];
char *str = "abcdefghi";
strcpy(s2, str);
printf("%s\n", s2);
strncpy(s1,str,3);
s1[3] = '\0';
printf("%s\n", s1);
char *st = "Borland International";
printf("%d\n", strlen(st));
char destination[7];
char* blank = " ", *c = "C++", *turbo = "Turbo";
strcpy(destination, turbo);
strcat(destination, blank);
strcat(destination, c);
printf("%s\n", destination);
char* source = "structured ";
strcpy(destination, "programming ");
strncat(destination, source, 5);
printf("%s\n", destination);
char* buf1 = "aaabbb", * buf2 = "cccaaa", * buf3 = "ccc";
int ptr = strncmp(buf2,buf1,3);
if (ptr > 0)
printf("buffer 2 is greater than buffer 1\n");
else
printf("buffer 2 is less than buffer 1\n");
ptr = strncmp(buf2,buf3,3);
if (ptr < 0)
printf("buffer 2 is greater than buffer 3\n");
else
printf("buffer 2 is less than buffer 3\n");
char* string ="This is a string";
char *p, c1 = 'r';
char srci [11]="01234567897";
int ch = '7';
char *ach;
ach=strchr (srci,ch);
if (ach==NULL)
printf ("Символ в строке не найден\n");
else
printf ("Искомый символ в строке на позиции # %d\n",ach-srci+1);
ach=strrchr (srci,ch);
if (ach==NULL)
printf ("Символ в строке не найден\n");
else
printf ("Искомый символ в строке на позиции # %d\n",ach-srci+1);
char *string1 = "abcdefghijklmnopqrstuvwxyz";
char *string2 = "tyute";
int *ptr;
ptr = strpbrk(string1, string2);
if (ptr)
printf("strpbrk found first character: %c\n", *ptr);
else
printf("strpbrk didn't find character in set\n");
int length = strspn(string1, string2);
printf("Character where strings differ is at position %d\n", length);
length = strcspn(string1, string2);
printf("Character where strings intersect is at position %d\n", length);
char str [24]=" test1/test2/test3/test4";
char sep [10]="/";
char *istr;
printf ("Исходная строка: %s\n", str);
printf ("Результат разбиения:\n");
istr = strtok (str,sep);
while (istr != NULL)
{
printf ("%s\n",istr);
istr = strtok (NULL,sep);
}
return 0;
}