-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path5_2_2.c
57 lines (55 loc) · 860 Bytes
/
5_2_2.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
#include <stdio.h>
#include <stdlib.h>
int dlugosc(char*napis)
{
int i = 0;
while(napis[i]!=0)
{
i++;
}
return i;
}
int dlugosc2(char*napis)
{
int i=0;
while(*(napis+i)!=0)
{
i++;
}
return i;
}
int dlugosc3(char*napis)
{
int i=0;
for(i=0; napis[i]!=0; i++)
{
}
return i;
}
int dlugosc4(char*napis)
{
if(*napis==0)
{
return 0;
}
return dlugosc4(++napis)+1;
}
int dlugoscwchart(wchar_t*napis)
{
int i = 0;
while(napis[i]!=0)
{
i++;
}
return i;
}
int main()
{
char*nap = "asdasdsa";
char nap2[10]="abc";
printf("%d\n", dlugosc3(nap));
printf("%d\n", dlugosc4(nap2));
wchar_t*nap3 = L"aksjhdajksdhaj";
printf("%d", dlugoscwchart(nap3));
return 0;
}