________________________________


I have run this programs.....

In first program, you are giving a value to variable 'a' is 100;
now suppose your address is -12.
then you will be stop the program one.
and you will execute program 2(file2.c)
so previous variable value will be deleted by compiler automatically.....
so when you will run the program 2 you will not get the value of pa as 100.
It will be any garbage value.
and then you are also setting the value of pa to 10.
and if then you will not set the value of variable 'a' as 100 & you will also 
don't get the value of 'a' as 10.
It will be also garbage value.



 
You have 2 files say file1.c and file2.c
>
>contents of file1.c are as follows :
>
>int main()
>{
>int a=100;
>
>printf(" %d", &a);
>
>getch(); //Halt the execution
>
>printf(" %d", a);
>
>}
>
>contents of file2.c are as follows :
>
>int main()
>{
>int *pa = (int*)(Here comes the address that was printed in file1.c);
>
>*pa = 10;
>
>}
>
>after halting the file1.c execution , file2.c is executed and then file1.c is 
>resumed again to see the contents of a. What would be the output?
>
>
>
>  
>
>




[Non-text portions of this message have been removed]

Reply via email to