C语言报错:error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token|
C语言写代码的时候碰到问题: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘ attribute ’ before ‘{’ token| 检查了很长时间什么都没发现,网上看大家出现这个错误有很多原因。希望以后不用再给自己补充。 报错原因: 语法错误,缺少了一些必要的符号。 报错代码: 这里是函数声明忘记了分号。 # include <stdio.h> # include <stdlib.h> # include <math.h> void money ( int year , int loan , float rate ) int main ( ) { int n , loan ; float rate ; printf ( "Input loan:" ) ; scanf ( "%d" , & loan ) ; printf ( "Input rate:" ) ; scanf ( "%f" , & rate ) ; for ( n = 5 ; n <= 30 ; n ++ ) money ( n , loan , rate ) ; return 0 ; } void money ( int year , int loan , float rate ) { int loan , month ; month = year * 12 ; money =