Take a odd string give output middle of string

#include<conio.h>
#include<stdio.h>
#include<iostream.h>
#include<string.h>
char func( char str1[]);
void main(void)
{
 clrscr();
 char a[20],result;
 cout<<"enter any word";
 gets(a);
 result=func(a);
 cout<<result;
 getch();
}
char func(char str1[])
{
 int a,b,f;
 char m;
 a=strlen(str1);
 if((a%2)==1);
 {
 m=char(str1);
 return m;
 }
}

for example:
cat input

output
a

Some points:

• Post your code in code tags.

• Don't use gets for accepting input from the user. Read this.

• Remove the semicolon after the if statement in your function. Its ruining your logic.

m = (char) str1; The above statement doesn't do what you expect it to do. It converts a address to character, something which you don't want here.