main()
{
int *j;
{
int i=10;
j=&i;
}
printf("%d",*j);
}
Answers were Sorted based on User's Feedback
Answer / susie
Answer :
10
Explanation:
The variable i is a block level variable and the visibility
is inside that block only. But the lifetime of i is lifetime
of the function so it lives upto the exit of main function.
Since the i is still allocated space, *j prints the value
stored in i since j points i.
Is This Answer Correct ? | 78 Yes | 5 No |
Answer / vishu
the answer is that
int i varibale is part of int*j block code ,but outside the
block of code i variable also show their existanse.if we
write a code after the int*j block of code .
int*h
{
h=&i
}
printf("%d",*h);
}
Is This Answer Correct ? | 11 Yes | 3 No |
Answer / bipin chandra sai.s
actually j has beeen assigned the addresss of i so the ans
will be the value present in the address location 10
Is This Answer Correct ? | 7 Yes | 1 No |
Answer / jerome.s,final year eee,adhipa
There i-is initialised by 10.
and j-also initialised by address of i.
so *j is the value in the address of j.
therefore,
*j=i=10.
OUTPUT:
10
Is This Answer Correct ? | 7 Yes | 1 No |
Answer / ashish p
The answer is undefined.
int *j;
{ //prolog
int i=10;
j = &i;
}//epilog
in the above code , at the prolog level the variables are
pushed into a un-named function space on the stack. Whereas
at epilog level the variable i dies.
J contains address of valid memory location but invalid
contents. Since i's memory is release back, any other
program can claim it and over-ride the contenets. Unless
then if we try to print the content using J it will give us
the value 10.
Which is not recommended it is something like returning
reference to the local variable in a function.
Is This Answer Correct ? | 1 Yes | 1 No |
Answer / govind verma
i think ans will be 10 because here is the concept of dagling pointer......
Is This Answer Correct ? | 0 Yes | 0 No |
Write a program using one dimensional array to assign values and then display it on the screen. Use the formula a[i]=i*10 to assign value to an element.
1 Answers Samar State University,
How can you relate the function with the structure? Explain with an appropriate example.
respected sir, i did my MCA in 2013 when i am going to attend to an interview i was asked about my project how will i explain my project could please help me in this and my project title is "Social Networking Site For Social Responsibility"
#include<stdio.h> main() { struct xx { int x; struct yy { char s; struct xx *p; }; struct yy *q; }; }
main( ) { int a[ ] = {10,20,30,40,50},j,*p; for(j=0; j<5; j++) { printf(ā%dā ,*a); a++; } p = a; for(j=0; j<5; j++) { printf(ā%d ā ,*p); p++; } }
int a=1; printf("%d %d %d",a++,a++,a); need o/p in 'c' and what explanation too
Write a program to receive an integer and find it's octal equivalent. How can i do with using while loop.
PROG. TO PRODUCE 1 1 1 1 2 1 1 3 3 1 1 4 6 4 1
Link list in reverse order.
Write a program that find and print how many odd numbers in a binary tree
can u give me the c codings for converting a string into the hexa decimal form......
What is full form of PEPSI