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 4 of 5.

Ashi said:   1 decade ago
Can anyone tell me what is the reason why we can not pass static variables in a function?

Avinash said:   9 years ago
What kind of function is this?

int *check();

I mean what does the * sign denote here?

Xstream said:   1 decade ago
Static members are cannot be used as arguments in a function its a general rule.

Karthik said:   1 decade ago
Can any one explain that, what happens when the parameters are non-static?

Omar said:   5 years ago
@Avinash.

* means that's this function return pointer to integer value.
(2)

Sumit said:   1 decade ago
Static member is initialized to 0 so can't be passed as arguments.

Kingalbert4m said:   1 decade ago
Static member function cann't access the non static members.

Mani said:   1 decade ago
Static member function cannot access the non static members.

Praju said:   9 years ago
Can anyone please explain question with the correct program?

Sarang S. Metkar said:   1 decade ago
Can anyone tell me what is d meanining of "timid" ?


Post your comments here:

Your comments will be displayed after verification.