• retagged by
611 views
0 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?

1 Answer

Answer:
Position:
Show:

Related questions

1 1 vote
1 1 answer
639
639 views
Bikram asked May 14, 2017
639 views
What will be the output of the below program ?#include <stdio.h int main() { struct node { int x; int y; int z; }; struct node s = { 3, 5, 6 }; struct node *pt = &s; prin...
0 0 votes
1 answers 1 answer
561
561 views
Bikram asked May 14, 2017
561 views
Which of the following will print the value $2$ for this code snippet?#include<stdio.h int main() { int arr[10][20][30] = {0}; arr[5] = 2; __________ // missing line he...
3 3 votes
2 answers 2 answers
1.3k
1.3k views
Bikram asked May 14, 2017
1,316 views
What is the output of this program?#include <stdio.h int main() { char *ptr; char string[] = "How are you?"; ptr = string; ptr += 4; printf("%s",ptr); return 0; }How are ...
0 0 votes
1 answers 1 answer
431
431 views
Bikram asked May 14, 2017
431 views
The value of p after execution of the following program will be:int new(int t) { static int cal=0; cal=cal+t; return(cal); } main() { int t,p; for(t=0;t<=4;t++) p= new(t)...