edited by
1,379 views
1 votes
1 votes

Q1)

#include<stdio.h>
static int i;
static int i = 27;
static int i;
int main()
{
    static int i;
    printf("%d",i);
    return 0;
}



A) 27      B) 0      C) No Output         D)None of the these

Q2)
 

#include<stdio.h>
static int i;
static int i = 27;
static int i;
int main()
{
    printf("%d",i);
    return 0;
}


A) 27      B) 0      C) No Output         D)None of the these

Q3)
 

#include<stdio.h>
static int i = 0;
static int i = 27;
static int i;
int main()
    {
    printf("%d",i);
    return 0;
    }



A) 27      B) 0      C) No Output         D)None of the these

Q4)
 

#include<stdio.h>
static int i;
static int i = 27;
static int i =0;
int main()
    {
    printf("%d",i);
    return 0;
    }



A) 27      B) 0      C) No Output         D) None of the these

Q5)
 

#include<stdio.h>
static int i;
static int i = 27;
i = 45;
int main()
    {
    printf("%d",i);
    return 0;
    }



A) 27      B) 0      C) No Output         D)None of the these

@Arjun Sir please explain deeply, How to store the static variable in memory?

edited by

1 Answer

–1 votes
–1 votes

1) 0

2) 27

3)error

4)error

5)error becz we cant assign globally

Related questions

1 votes
1 votes
1 answer
1
1 votes
1 votes
3 answers
2
jverma asked May 23, 2022
1,060 views
#include <stdio.h>int f(int n){ static int r = 0; if (n <= 0) return 1; r=n; return f(n-1) + r;}int main() { printf("output is %d", f(5)); return 0;}Ou...
0 votes
0 votes
1 answer
3
srestha asked Nov 18, 2018
1,287 views
Is it static declaration or static assignment?int main() { int x=20; static int y=x; if(x==y) printf("Equal"); else printf("Not Equal"); return 0; }What is output?and why...
2 votes
2 votes
2 answers
4
Ravi prakash pandey asked Nov 14, 2017
356 views
i think it would be static local variable