Тест 3 - часть 5
return(q);
}
// 27------------------------------------------------------
int *F(char *p)
{ char *s;
int *q;
int n,i;
n = strlen(n);
q = malloc(n + sizeof(int));
*q = n;
for (s = q+1; *p != '\0'; *s++ = *p++);
return q;
}
// 28------------------------------------------------------
void F(char *p)
{
while (*p!=0)
if (*p=='*')
{
p++;
printf("%d",*(int*)p );
p += sizeof(int);
}
else putchar(*p++);
}
// 29------------------------------------------------------
double F(int *p)
{ double *q,s;
s =0;
while (*p!=-1)
{
if (*p !=0) s += *p++;
else
{ q = p; s += *q++; p=q; }
}
}
// 30------------------------------------------------------
void F(char *p)
{
while (*p!=0)
if (*p=='*')
{
p++;
puts(*(char **)p);
p += sizeof(char *);
}
else putchar(*p++);
}
// 31-------------------------------------------------------
#include <stdio.h>
void F(char *p,...)
{ char **q;
for (q = &p; *q !=NULL; q++) puts(*q);
}
// 32-------------------------------------------------------
void F(int *p,...)
{ int **q, i, d;
for (i=1, q = &p, d=*p; q[i]!=NULL; i++)
*q[i-1] = *q[i];
*q[i-1] = d;
}
// 33-------------------------------------------------------
int *F(int *p,...)
{ int **q, i, *s;
for (i=1, q = &p, s=p; q[i]!=NULL; i++)
if (*q[i] > *s) s = q[i];
return (s);
}
// 34-------------------------------------------------------
int F(int p[], int a1,...)
{ int *q, i;
for (i=0, q = &a1; q[i] > 0; i++)
p[i] = q[i];
return i;
}
// 35-------------------------------------------------------
union x { int *pi; long *pl; double *pd; };
void F(int p)
{ union x ptr;
for (ptr.pi = &p; *ptr.pi != 0; )
{
switch(*ptr.pi++)
{
case 1: printf("%d", *ptr.pi++); break;
case 2: printf("%ld", *ptr.pl++); break;
case 3: printf("%f", *ptr.pd++); break;
}
}
}
// 36--------------------------------------------------------
#include <stdio.h>
char **F(char *p,...)
{ char **q,**s;
int i,n;
for (n=0, q = &p; q[n] !=NULL; n++);