C Programming - Pointers - Discussion

Discussion Forum : Pointers - Find Output of Program (Q.No. 8)
8.
What will be the output of the program ?
#include<stdio.h>
int *check(static int, static int);

int main()
{
    int *c;
    c = check(10, 20);
    printf("%d\n", c);
    return 0;
}
int *check(static int i, static int j)
{
    int *p, *q;
    p = &i;
    q = &j;
    if(i >= 45)
        return (p);
    else
        return (q);
}
10
20
Error: Non portable pointer conversion
Error: cannot use static for function parameters
Answer: Option
Explanation:
No answer description is available. Let's discuss.
Discussion:
50 comments Page 5 of 5.

Abiramidevaraj said:   1 decade ago
I can't understand why it is printing 1 instead 11.

Mekalacheruvu purushotham said:   1 decade ago
It is a function which returns integer pointer.

Sushovan said:   10 years ago
Parameters will not be static. Its not allowed.

Sujan said:   9 years ago
What would be the answer if it wasn't static?

Sai said:   1 decade ago
What is storage class ? can any one explain ?

Nikhil said:   1 decade ago
Parameters are never static.. its not allowed

Kushal said:   1 decade ago
Cannot use static in function argument.

Sachin said:   1 decade ago
Can any one explain this one please?

Sujan said:   1 decade ago
return 0. Can any one explain?

Amit said:   8 years ago
Static is not allowed.


Post your comments here:

Your comments will be displayed after verification.