|< 1 2 3 4 >| | 37 Einträge, 4 Seiten |
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
int readnumber(char* string, int* ppos)
{
int result = 0;
while(*ptr >= '0' && *ptr <= '9')
{
result *= 10;
result += *ptr;
ptr++;
*ppos++;
}
return result;
}
int calcstring(char* string, int* ppos)
{
char* ptr = string;
int result = 0;
int idx = 0;
while(*ptr)
{
int pos = 0;
if(*ptr == '(')
{
result = calcstring(ptr++, &pos);
ptr += pos;
idx += pos;
}
else if(*ptr == ')')
{
if(ppos) *ppos = idx;
return result;
}
else if(*ptr >= '1' && *ptr <= '9')
{
int num = readnumber(ptr, &pos);
printf("num gelesen: %i\n", num);
ptr += pos-1;
idx += pos-1;
}
idx++; ptr++;
}
return result;
}
|< 1 2 3 4 >| | 37 Einträge, 4 Seiten |