Информатика и технология программирования


Тест 2 - часть 5


(*pf)(q-&#62data);
}
// 32--------------------------------------------------------


struct mxxx { void **data; mxxx *next; };
void F( mxxx *p, void (*pf)(void*))
{
void **q;
for (; p != NULL; p = p-&#62next)
for (q = p-&#62data; *q != NULL; q++)
(*pf)(*q);
}
// 33--------------------------------------------------------


void F(void ***p, void (*pf)(void*))
{
void **q;
for (; *p != NULL; p++)
for (q = *p; *q != NULL; q++)
(*pf)(*q);
}
// 34--------------------------------------------------------


void F(void *p, int sz, int n, void (*pf)(void*))
{
char *q;
for (q = p; n &#62 0; n--, q+=sz)
(*pf)(q);
}
// 35--------------------------------------------------------


struct xxx { void *data; xxx **link; };
void F( xxx *p, void (*pf)(void*))
{
xxx **q;
if (p==NULL) return;
(*pf)(p-&#62data);
for (q = p-&#62link; *q != NULL; q++)
F(*q,pf);
}
// 36--------------------------------------------------------


struct xxx { void **data; xxx *r, *l; };
void F( xxx *p, void (*pf)(void*))
{
void **q;
if (p==NULL) return;
F(p-&#62r, pf);
for (q = p-&#62data; *q != NULL; q++)
(*pf)(*q);
F(p-&#62l, pf);
}
// 37-------------------------------------------------------


struct xxx { void *data; xxx *next; };
struct zzz { xxx *ph; zzz *r, *l; };
void F( zzz *p, void (*pf)(void*))
{
xxx *q;
if (p==NULL) return;
F(p-&#62r, pf);
for (q = p-&#62ph; q != NULL; q = q-&#62next)
(*pf)(q-&#62data);
F(p-&#62l, pf);
}
// 38-------------------------------------------------------


struct xxx { void *data; xxx *next,*pred; };
void F( xxx *p, void (*pf)(void*))
{
xxx *q;
if (p==NULL) return;
q = p;
do {
(*pf)(q-&#62data);
q = q-&#62next;
} while (q != p);
}
// 39-------------------------------------------------------


void F(void ***p, int (*pf)(void*))
{
int i,j;
for (i =0; p[i] != NULL; i++)
for (j =0; p[i][j] != NULL; j++)
if ((*pf)(p[i][j])) return p[i][j];
return NULL;
}
// 40--------------------------------------------------------


struct xxx { int v; xxx **pp; };



Начало  Назад  Вперед



Книжный магазин