perl 语言表达C语言里的结构体?
perl语言要怎样表达C语言里的结构体,请以下代码为例用perl语言表达。structcenter_point{floatx,y,dx,dy;}structcenter_...
perl 语言要怎样表达C语言里的结构体, 请以下代码为例 用perl 语言表达。
struct center_point
{
float x,y,dx,dy;
}
struct center_point cp[];
struct drc_cp[]; 展开
struct center_point
{
float x,y,dx,dy;
}
struct center_point cp[];
struct drc_cp[]; 展开
2个回答
展开全部
use Clone qw/clone/;
use Data::Dumper;
$center_point = {
x => undef, y => undef,
dx => undef, dy => undef,
};
$cp = clone $center_point;
$center_point -> {x} = 1; $center_point -> {y} = 2;
$cp -> {x} = "a"; $cp -> {y} = "b";
print Dumper $center_point;
print Dumper $cp;
use Data::Dumper;
$center_point = {
x => undef, y => undef,
dx => undef, dy => undef,
};
$cp = clone $center_point;
$center_point -> {x} = 1; $center_point -> {y} = 2;
$cp -> {x} = "a"; $cp -> {y} = "b";
print Dumper $center_point;
print Dumper $cp;
本回答被网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询