Skip to main content
added a thousand words
Source Link
DinoCoderSaurus
  • 28.6k
  • 2
  • 12
  • 31

The problem is not the { per se, that's just where the compiler finds a problem. The problem is the ;. If program is defining a function prototype the ; would be necessary (and the function logic would come later in the program). Since main is the main loop of the program the correct declaration is

int main(void) {

FYI if you expand the Source Code option under the lecture on the class page, and choose Index, you can download any/all the sources from the lecture.

screen grab

The problem is not the { per se, that's just where the compiler finds a problem. The problem is the ;. If program is defining a function prototype the ; would be necessary (and the function logic would come later in the program). Since main is the main loop of the program the correct declaration is

int main(void) {

The problem is not the { per se, that's just where the compiler finds a problem. The problem is the ;. If program is defining a function prototype the ; would be necessary (and the function logic would come later in the program). Since main is the main loop of the program the correct declaration is

int main(void) {

FYI if you expand the Source Code option under the lecture on the class page, and choose Index, you can download any/all the sources from the lecture.

screen grab

Source Link
DinoCoderSaurus
  • 28.6k
  • 2
  • 12
  • 31

The problem is not the { per se, that's just where the compiler finds a problem. The problem is the ;. If program is defining a function prototype the ; would be necessary (and the function logic would come later in the program). Since main is the main loop of the program the correct declaration is

int main(void) {