相关疑难解决方法(0)

错误:'unary*'的无效类型参数(有'int')

我有一个C程序:

#include <stdio.h>
int main(){
  int b = 10;             //assign the integer 10 to variable 'b'

  int *a;                 //declare a pointer to an integer 'a'

  a=(int *)&b;            //Get the memory location of variable 'b' cast it
                          //to an int pointer and assign it to pointer 'a'

  int *c;                 //declare a pointer to an integer 'c'

  c=(int *)&a;            //Get the memory location of variable 'a' which is
                          //a pointer to 'b'.  Cast that to an int pointer 
                          //and assign it to …
Run Code Online (Sandbox Code Playgroud)

c pointers

26
推荐指数
3
解决办法
13万
查看次数

指针和结构

这是我的问题......我有这个代码(创建一个列表)

typedef struct node
{
    int pid;
    int runtime;
    struct node *next;
}job;

int main()
//code
job *first = NULL;
job *last = NULL;
job *newnode;
//code
//from here
if( first == NULL )
{
     first = last = newnode;
     newnode->next = NULL;
}
else
{
     last->next = newnode;
     last = last->next;
}
// to here
Run Code Online (Sandbox Code Playgroud)

所以我想在这里做一个函数之间的部分(所以看起来会更好)我做了这个...我创建了一个函数

void funct(job ** pfirst, job **plast, job*newnode);
Run Code Online (Sandbox Code Playgroud)

在主要而不是我使用的强大部分:

 funct(&first, &last, newnode);
Run Code Online (Sandbox Code Playgroud)

功能是这样的

void funct(job ** pfirst, job **plast, job*newnode)
{
   if(*pfirst == NULL) …
Run Code Online (Sandbox Code Playgroud)

c struct pointers

3
推荐指数
1
解决办法
166
查看次数

标签 统计

c ×2

pointers ×2

struct ×1