c语言指针函数和函数指针

C语言函数指针:

#include <stdio.h>

 

int sum(int a, int b){

      return a+b;

}

 

int main(){

      int (*p)(int,int);

      p = sum;

      printf("%d", p(1,34));

      return 0;

}

 

C语言指针函数:

#include <stdio.h>

 

char *fun(char *s1, char *s2){

      char *p = s2;

      while((*s2++= *s1++) != '\0');

      return s2;

}

 

void main(){

      char s1[] = "hello";

      char s2[128];

      char *p=fun(s1, s2);

      printf("%s", s2);

}

原文地址:https://www.cnblogs.com/itfenqing/p/4429454.html