感受指针之美,别出声
#include<stdio.h>#include<string.h>
char *f(char p[],int n)
{
static char t;
int i,max = 0;
for (i = 0;i < n;i++)
{
if (strlen (p) > max)
{
max = strlen(p);
strcpy (t,p);
}
}
return (t);
}
void main()
{
char p[] = {"abcdefg","abcd","abc","abcdefgh","cd","abcdef"};
printf("%s\n",f(p,6));
}
#include<stdio.h>
fun(char **m)
{
++m;
printf("%s\n",*m);
}
void main()
{
char *a[] = {"BASIC","FOXPRO","C"};
fun(a);
}
页:
[1]