在python发行版中,.h文件包含在include文件夹中(C:\ Users\x_user\AppData\Local\Programs\Python\Python36-32\include).我找不到这些.h文件的使用.这些.h文件的使用方式和位置(如果在任何python文件中)?我在Windows 8.1上运行python 3.6.4
编译代码时没有错误,但程序在两次输入后在运行时崩溃.也许有一些我无法解决的逻辑错误.我试图在链接列表的尾部插入节点,同时只保持头部位置.
#include<stdio.h>
#include<stdlib.h>
struct Node{
int data;
struct Node* next;
};
struct Node *head;
//print the element of the lists
void print(){
printf("\nThe list from head to tail is as follows \n");
struct Node* temp = head;
while(temp!=NULL){
printf("\n %d ",(*temp).data);
temp = (*temp).next;
}
}
//insert a node at the tail of the linked list
void insert_at_tail(int data){
struct Node* temp = head;
struct Node* new_node = (struct Node*)malloc(sizeof(struct Node));
new_node->data=data;
new_node->next=NULL;
if(temp==NULL){
head=new_node;
}
else{
while(temp!=NULL){temp=temp->next;}
(*temp).next=new_node;
} …Run Code Online (Sandbox Code Playgroud)