fork(2) download
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. typedef struct CpuNode
  5. {
  6. struct CpuNode *next;
  7. int cpuid;
  8. }CpuNode;
  9.  
  10. typedef struct List
  11. { struct CpuNode *HeadCpuNode;
  12. struct CpuNode *TailCpuNode;
  13.  
  14. }List;
  15.  
  16. inline static void push(struct List *q,CpuNode *n){
  17. struct CpuNode *temp;
  18.  
  19. temp= (struct CpuNode *)malloc(sizeof(struct CpuNode));
  20. temp->cpuid=n->cpuid;
  21. temp->next=NULL;
  22. if (q->HeadCpuNode==NULL) q->HeadCpuNode=q->TailCpuNode=temp;
  23. else {
  24. q->TailCpuNode->next=temp;
  25. q->TailCpuNode=temp;
  26. }
  27. }
  28.  
  29. void Discover(struct List *Acqcores){
  30. struct CpuNode temp;
  31. temp.cpuid=1;
  32. push(Acqcores,&temp);
  33. }
  34.  
  35.  
  36.  
  37. int main(int argc, char **argv) {
  38. struct List Acq_cores = {NULL, NULL};
  39. Discover(&Acq_cores);
  40. }
Success #stdin #stdout 0s 9296KB
stdin
Standard input is empty
stdout
Standard output is empty