edited by
209 views
0 votes
0 votes

 

#include <stdio.h>
int counter(int i)
{
    static int count = 0;
    count = count + i;
    return count;
}
int main()
{
    int i, j;
    for (i = 0; i <= 5; i++)
        j = counter(i);
    printf ("%d\n", j);
    return 0;
}

What is the output of the above program?

edited by

Please log in or register to answer this question.

Answer:

Related questions

0 votes
0 votes
1 answer
1
Bikram asked May 14, 2017
362 views
Spot the error(s) in this code snippet :int n=2; // Line 1 switch(n) { case 1.5: printf( "gate"); break; case 2: printf( "overflow"); break; case 'A': printf("gateoverflo...
1 votes
1 votes
1 answer
2
Bikram asked May 14, 2017
310 views
What is the output of the following program?#include <stdio.h int main() { int a = 0; switch(a) { default: a = 4; case 6: a ; case 5: a = a+1; case 1: a = a-1; } printf("...
7 votes
7 votes
2 answers
3
Bikram asked May 14, 2017
556 views
What is the output of the following code snippet? #include <stdio.h int main() { char c=125; c=c+10; printf("%d",c); return 0; }
2 votes
2 votes
1 answer
4
Bikram asked May 14, 2017
206 views
The output of this code snippet is :#include <stdio.h #define x 4+1 int main() { int i; i = x*x*x; printf("%d",i); return 0; }