Troubleshooting Compiler Errors: Get Expert Help with Your Homework Statement

  • Thread starter Thread starter NDiggity
  • Start date Start date
  • Tags Tags
    Compiler Error
AI Thread Summary
The user encountered a compiler error stating, "a function-definition is not allowed here before ‘{’ token," while working on their homework. They initially believed their solution was correct but were unsure of the error's cause. Upon further inspection, they discovered that the function needed to be defined above the main function in their code. This realization resolved the issue, allowing them to correct their code structure. Proper function placement is crucial for successful compilation in programming.
NDiggity
Messages
53
Reaction score
0

Homework Statement


Well I believe I have solved the problem correctly but I am not sure what I am doing wrong. I get the compiler error "a function-definition is not allowed here before ‘{’ token"

Here is my pasted code: http://rafb.net/p/8P4HYa49.html
 
Last edited:
Physics news on Phys.org
Nevermind, I realized I have to put the function above int main().
 

Similar threads

Back
Top