foo.c:4:13: error: expected ';', ',' or ')' before '&' token
void max(int& a,int b){ if(a<b)a=b; }
^
foo.c: In function 'main':
foo.c:7:5: error: 'for' loop initial declarations are only allowed in C99 mode
for(int i=0;i<n;++i){
^
foo.c:7:5: note: use option -std=c99 or -std=gnu99 to compile your code
foo.c:11:13: error: redefinition of 'i'
for(int i=1;i<n;++i)
^
foo.c:7:13: note: previous definition of 'i' was here
for(int i=0;i<n;++i){
^
foo.c:11:5: error: 'for' loop initial declarations are only allowed in C99 mode
for(int i=1;i<n;++i)
^
foo.c:12:9: error: 'for' loop initial declarations are only allowed in C99 mode
for(int j=0;j<i;++j)
^
foo.c:13:13: warning: implicit declaration of function 'max' [-Wimplicit-function-declaration]
if(s[i]>s[j]) max(f[i],f[j]+1);
^
foo.c:14:13: error: redefinition of 'i'
for(int i=n-2;~i;--i)
^
foo.c:11:13: note: previous definition of 'i' was here
for(int i=1;i<n;++i)
^
foo.c:14:5: error: 'for' loop initial declarations are only allowed in C99 mode
for(int i=n-2;~i;--i)
^
foo.c:15:17: error: redefinition of 'j'
for(int j=n-1;j>i;--j)
^
foo.c:12:17: note: previous definition of 'j' was here
for(int j=0;j<i;++j)
^
foo.c:15:9: error: 'for' loop initial declarations are only allowed in C99 mode
for(int j=n-1;j>i;--j)
^
foo.c:18:13: error: redefinition of 'i'
for(int i=0;i<n;++i) max(ans,f[i]+g[i]);
^
foo.c:14:13: note: previous definition of 'i' was here
for(int i=n-2;~i;--i)
^
foo.c:18:5: error: 'for' loop initial declarations are only allowed in C99 mode
for(int i=0;i<n;++i) max(ans,f[i]+g[i]);
^
foo.c:20:1: warning: control reaches end of non-void function [-Wreturn-type]
}
^