【发布时间】:2013-03-23 10:08:23
【问题描述】:
#define MAX_THREADS ( 17 )
struct thread_info
{
unsigned int * thread_sp; /* Storage space for thread stack-pointer. */
int thread_id; /* Storage space for a thread ID. */
};
struct thread_info thread_info_array[ MAX_THREADS ];
我不明白第二个结构,你能解释一下它的作用吗?如果我们改变常量,常量如何改变结构体?
更新
我认为它与以下内容相同:
struct thread_info { unsigned int *thread_sp; int thread_id; } thread_info_array[MAX_THREADS];
【问题讨论】:
-
不太一样,那个单一版本缺少结构标签。
-
@teppic 谢谢。
struct thread_info { unsigned into * thread_sp; int thread_id; } thread_info_array[MAX_THREADS];(?) -
几乎一样。但是在这里,您定义了一个未命名类型的变量 - 您将无法在其他任何地方使用此类型,例如与第一个版本相比,您不能再定义任何此类变量。
-
@icepack - 标签存在,没有问题。
-
@teppic 同意,问题已编辑
标签: c arrays multithreading struct