Fortran代码:
program TestFortran
implicit none
call char();
end program TestFortran
!char型
subroutine char ()
implicit none
character(3) ::c1
character(3) ::c2
c1 = "1.2"
c2 = "3.4"
call CHARR(c1, c2)
end subroutine char
end subroutine sub
C++代码:
//char型
extern "C" void CHARR(char *a, char *b)
{
return;
}
问题描述:Fortran调用C++中的CHARR函数,传参为字符型变量。
我想要C++得到a == 1.2, b == 3.4.
但是实际发现a的值为1.2 3.4,b的值为3.4
请问怎么解决问题?我想要a的值为Fortran中c1的值,b的值为Fortran中c2的值.