Your definition for
main
and
rec
are both missing the return type. Change them to:
void main()
void rec(int a,int b,char s[][],char T[],char x)
Note that strictly speaking,
main
should use
int
as its return type.
[edit]
Note that there is also quite a bit wrong with your logic, particularly your methods of reading input data.
[/edit]