[ create a new paste ] login | about

Link: http://codepad.org/I9kykhSU    [ raw code | output | fork ]

C, pasted on Nov 24:
#include <stdio.h>
#include <stdlib.h>

#include <stdio.h>
#define N 100
void CountStars(char *a[][],int b;char *c)
{
  int n;
  for(n=0;n<b;n++)
  {
      int i,sum=0;
      for(i=0;i<b;i++)
      {
          if(a[n][i]=='*')
            sum++;
      }
  }
  *c=sum;
}
/* PRESET CODE BEGIN - NEVER TOUCH CODE BELOW */

int main()
{
int w,i,j,count;
char stars[N][N];
scanf( "%d", &w );
getchar();  //吸收回车符
  	for ( i = 0; i < w; i++ )
		gets( stars[i] );
  	CountStars( stars, w, &count );
  	printf( "%d\n", count );
    return 0;
}

/* PRESET CODE END - NEVER TOUCH CODE ABOVE */


Output:
1
2
3
4
5
6
7
8
9
10
11
12
Line 6: error: array type has incomplete element type
Line 6: error: parameter 'b' has just a forward declaration
Line 6: error: parameter 'a' has just a forward declaration
In function 'CountStars':
Line 9: error: 'b' undeclared (first use in this function)
Line 9: error: (Each undeclared identifier is reported only once
Line 9: error: for each function it appears in.)
Line 14: error: 'a' undeclared (first use in this function)
Line 18: error: 'sum' undeclared (first use in this function)
In function 'main':
Line 30: warning: passing argument 1 of 'CountStars' from incompatible pointer type
Line 30: error: too many arguments to function 'CountStars'


Create a new paste based on this one


Comments: