Actions

EmSys

CCoding Style - Be careful with side effects3

From EdWiki

Be careful with side effects ...

It is not just increment and decrement that have side effects; Input/Output is another source of behind-the-scenes action.

scanf(“%d %d”, &yr, &profit[yr]);

Break it into two statements:

scanf(“%d”, &yr);
scanf(“%d”, &profit[yr]);