I was just playing around with pointers. In the following code what i feel is once check is executed the variable i and j must get killed as soon as the function returns. So actually we should not be able to collect it in the variable 'c' inside the main. Guys please tell whether my justification is right or wrong ?
Code:
int* check(int,int);

void main()
{
	int *c;
	c = check(10,20);
	printf("\nc = %d",*c);
}

int* check(int i, int j)
{
	int *p, *q;
	p = &i;
	q = &j;
	if(i >= 45)
		return(p);
	else
		return(q);
}

Last edited by shabbir; 29Mar2008 at 17:27.. Reason: Code block