1 #define N 20
   2 void edge(int m[N][N]) {
   3     int i;
   4     for(i = 0; i < N; i++) {
   5         m[0][i] = 0;
   6         m[N-1][i] = 0;
   7         m[i][0] = 0;
   8         m[i][N-1] = 0;
   9     }
  10 }

   1 void fun(char *s, char *t){
   2     while(*s!='\0') {
   3         if(isdigit(*s)) {
   4             *t++ = '$';
   5         }
   6         *t++ = *s++;
   7     }
   8     *t = '\0';
   9 }

   1 void foreach(int a[], int n, void (*f)(int))
   2 {
   3     int i;
   4     for(i = 0; i < n; i++)
   5         (*f)(a[i]);
   6 }

   1 #include <stdio.h>
   2 #include <stdlib.h>
   3 
   4 int main(int argc, char *argv[]) 
   5 {
   6     int sum = 0;
   7     int i;
   8     for( i = 1; i < argc; i++)
   9         sum+=atoi(argv[i]);
  10     if(argc!=1)
  11         printf("%f", (double)sum / (argc -1));
  12     return 0;
  13 }

C语言练习3 (2008-02-23 15:34:09由localhost编辑)

ch3n2k.com | Copyright (c) 2004-2020 czk.