本文介绍了变量由struct声明的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我的问题是将变量x1,x2和x3声明为复杂类型的结构
我可以知道下面的答案正确吗?
my question is declare variable x1, x2 and x3 as structure of type complex
may i know my below answer correct?
struct complex{
struct complex *x1;
struct complex *x2;
struct complex *x2;
};
推荐答案
struct complex
{
// struct members
double realPart;
double imaginaryPart;
};
void Foo()
{
struct complex x1;
struct complex x2;
struct complex x3;
}
struct COMPLEX x1;
struct COMPLEX x2;
struct COMPLEX x3;
如果...
if...
struct COMPLEX{
double real;
double imaginary;
};
或...
or...
COMPLEX x1;
COMPLEX x2;
COMPLEX x3;
如果...
if...
typedef struct _COMPLEX_{
double real;
double imaginary;
} COMPLEX;
这篇关于变量由struct声明的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!