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
|
#include "cfwobject.h"
#include "cfwstring.h"
#include "cfwarray.h"
int
main()
{
CFWArray *a;
CFWString *s;
size_t i;
a = cfw_new(cfw_array);
for (i = 0; i < 3; i++) {
s = cfw_new(cfw_string);
switch (i) {
case 0:
cfw_string_set(s, "Hello");
break;
case 1:
cfw_string_set(s, "World");
break;
case 2:
cfw_string_set(s, "!");
break;
}
cfw_array_push(a, s);
cfw_unref(s);
}
for (i = 0; i < cfw_array_size(a); i++)
puts(cfw_string_c(cfw_array_get(a, i)));
return 0;
}
|
>
<
|
<
<
|
<
<
<
<
<
<
<
<
<
|
<
|
|
<
<
<
|
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
#include "cfwobject.h"
#include "cfwstring.h"
#include "cfwarray.h"
int
main()
{
CFWString *s[3];
CFWArray *a;
size_t i;
s[0] = cfw_new(cfw_string, "Hallo");
s[1] = cfw_new(cfw_string, "Welt");
s[2] = cfw_new(cfw_string, "!");
a = cfw_new(cfw_array, s[0], s[1], s[2], NULL);
for (i = 0; i < cfw_array_size(a); i++)
puts(cfw_string_c(cfw_array_get(a, i)));
return 0;
}
|