🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

1 total messages Started by Jim Knutson Sat, 17 Jun 1989 16:56
Why is this an error?
#65
Author: Jim Knutson
Date: Sat, 17 Jun 1989 16:56
16 lines
633 bytes
If variables can be declared anywhere, why is the int sum
declaration below an error?  This happens when using g++ 1.35.0.

#include <stream.h>

main()
{
	for (int i = 1; i < 10; i++) {
		int sum += i;		// += is a parse error
		printf("i = %d, sum = %d\n",i,sum);
	}
}
-- 
Jim Knutson
knutson@mcc.com
cs.utexas.edu!milano!knutson
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads