left shift and right shift operators ??

Ingo Krabbe ikrabbe@earthling.net
Wed Jun 20 06:12:00 GMT 2001


On Wed, 20 Jun 2001, Ingo Krabbe wrote:
> 	for ( int i = 1; i != 0; i<<1 ) /* OOPS this is wrong */
> 		printf( "%x", i );
>

The right way to do it is:

	for ( int i = 1; i != 0; i<<=1 ) /* which means i = i<<1; */
		printf( "%x", i );

CU INGO



More information about the Gcc-help mailing list