435,064 Members | 1,388 Online
Need help? Post your question and get tips & solutions from a community of 435,064 IT Pros & Developers. It's quick & easy.

# Getting the error "expected identifier or '(' before '{' token in C

P: 2
As shown in the attachment, I'm getting the error "expected identifier or '(' before '{' token in C, can anyone help me with this error? I'm using Code::Blocks 13.12

Expand|Select|Wrap|Line Numbers
1. #define md1(i, m, n)
2. {
3.     factor= 1+i/m;
4.     ratio=(12/m)*(pow(factor,m*n)-1)/(i/m);
5. }
6. #define md2(i, m, n)
7. {
8.     factor= 1+i/m;
9.     ratio=(pow(factor,m*n)-1)/(pow(factor,m/12)-1);
10. }
11. #define md3(i, n)
12. {
13.     ratio=(exp(i*n)-1)/(exp(i/12)-1);
14. }
15.
16.

Attached Images
 error.jpg (53.8 KB, 1066 views)
Nov 14 '15 #1

For a multi-line define use the line-continuation character, \.
Your code will then look something like this
Expand|Select|Wrap|Line Numbers
1. #define md1(i, m, n)\
2. { \
3. factor= 1+i/m;\
4. ratio=(12/m)*(pow(factor,m*n)-1)/(i/m); \
5. )
6.