Idea well, try it 

Forum: U Chicago, Com Sci 221, autumn 2000
Re: News Take-home midterm exam, due 6 November (Mike O'Donnell)
Re: Question About the last problem in the Mid-term (Zhenglong Gu)
Date: 2000, Nov 08
From: C. Donour Sizemore donour

I've been watching this thread all day. Hopefully, this will make it clear to everyone. Compile this and watch what happens. Ask if you still have questions.

,d

#include <stdio.h>

int main()
{
	int *x , xval , y;

        /* Create some variables */

	xval = 5;
	x = &xval;
	y = 2;
	printf("x = %d\n",x);
	printf("*x = %d\n",*x);
	printf("y = %d\n\n",y);

        /* The expression in question */
	printf("let *x = y\n");
	*x = y;
	printf("x = %d\n",x);
	printf("*x = %d\n\n",*x);

        /* what may _appear_ to be happening in some 
           interpretations   */
	printf("Now x = y\n");
	x = y;
	printf("x = %d\n",x);
	printf("x (address %d) cannot be printed\n",x);

return 0; }


Messages

1. Feedback reference my previous comment by Michael C. Brizic, 2000, Nov 09

to: "well, try it"