0

What is wrong with folowing if statement in C (at least 3)

if numNeighbors>=3 || numNeighbors=4 ++numNeighbors; printf("You are dead!\n"); else --numNeighbors;

24th Jan 2017, 4:19 PM
Aloka Devapriya
Aloka Devapriya - avatar
3 Antworten
+ 3
() in if condition ; in printf statement and most important { } inside if block. if (numNeighbors>=3 || numNeighbors==4) { ++numNeighbors; printf("You are dead!\n"); } else --numNeighbors;
24th Jan 2017, 4:48 PM
Rishabh Agrawal
Rishabh Agrawal - avatar
0
in printf statement thr is a semicolon know?
29th Nov 2018, 1:41 AM
Hiruni Liyanage
Hiruni Liyanage - avatar
- 1
Assuming C#: 1) Should be numNeighbors == 4 not = 2) Need {} around two lines after first conditional 3) Need semicolon at end of printf line
24th Jan 2017, 5:14 PM
Josh Davidson
Josh Davidson - avatar