c - 第二个 printf 不工作,需要帮​​助。 (C郎)

标签 c linked-list

这里有什么问题?它打印第一个 printf 但不打印下一个语句 感谢帮助。

代码:

#include<stdio.h> 
#include<stdlib.h>

struct node
{
  int Data;
  struct node *Link;
};

//close struct
void insertAtEnd(struct node *Itcstd, int iData)
{
  while (Itcstd->Link != NULL )
    Itcstd = Itcstd->Link;

  Itcstd->Link = (struct node*) malloc(sizeof(struct node));
  Itcstd->Link->Link = NULL;
  Itcstd->Link->Data = iData;
} //close insertAtEnd

int main()
{
  struct node *EHead;

  EHead = (struct node*) malloc(sizeof(struct node));
  EHead->Link = NULL;
  EHead->Data = 4;

  printf("EHead link: %p Ehead Data: %d\n", EHead->Link, EHead->Data);
  insertAtEnd(EHead, 10);
  printf("EHead link: %p Ehead Data: %d\n", EHead->Link, EHead->Data);

  return 0;
} //close main

最佳答案

实际上这是一个很好的代码,它非常适合我。 (我可以看到两行。)

关于c - 第二个 printf 不工作,需要帮​​助。 (C郎),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19973584/

相关文章:

java - JNI - "Cannot open include file: ' jni_md.h'"

c - 不使用时删除posix共享内存?

c++ - 返回链表中最后一个元素的第 5 个元素?

c - 我们什么时候应该使用链表而不是数组,反之亦然?

c++ - 遍历链表插入 STL vector 值

c++ - 可以在 C 中更改 const 的值,但不能在 C++ 中更改

c - 使用偏移量获取微 Controller 中寄存器完整地址的目的是什么?

c - 如何在 concatenate-stringify 级联中延迟宏替换

c - 使用链表进行冒泡排序

c - print_list 函数只打印链表中用户的第一个输入