[ create a new paste ] login | about

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

C, pasted on Aug 18:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#include<stdio.h> 
#define NUMBER_OF_FUNC_CALLS 3

void fun() 
{ 
   static int count = 0; 
   count++;
   printf(" In main count is %d\n", count); 
   return; 
} 

int main() 
{ 
   int i; 
   for (i = 0; i < NUMBER_OF_FUNC_CALLS; i++) {
      fun();
      printf(" In main count is %d\n", count); 
   }
   return 0; 
}


Output:
1
2
3
4
In function 'main':
Line 17: error: 'count' undeclared (first use in this function)
Line 17: error: (Each undeclared identifier is reported only once
Line 17: error: for each function it appears in.)


Create a new paste based on this one


Comments: