i basically want to take int name and string age from user in c# and send it to dll method written in c which take int and char[50] arguments in it and return string .i crea
Within a struct, to marshal char arrays defined as char[] you should use the UnmanagedType.ByValTStr instead.
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
public struct Argument
{
public int age;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 50)]
public string name;
}