▼ กำลังโหลดข้อมูล... ▼
แสดงความคิดเห็น
คุณสามารถแสดงความคิดเห็นกับกระทู้นี้ได้ด้วยการเข้าสู่ระบบ
กระทู้ที่คุณอาจสนใจ
[Error] Id return 1 exit status C++
#include<stdio.h>
#include<iostream>
using namespace std;
struct record { // Link list
int value;
struct record *next;
};
voi
สมาชิกหมายเลข 5279395
อ่านกระทู้อื่นที่พูดคุยเกี่ยวกับ
วิทยาศาสตร์คอมพิวเตอร์
วิศวกรรมคอมพิวเตอร์
C (ภาษาคอมพิวเตอร์)
C++
การออกแบบฐานข้อมูล
รบกวนปรมจารย์ด้านภาษาซี ช่วยมาอธิบายโค้ดนี้ทีค่ะ TT^TT
รบกวนช่วยอธิบายหน่อยค่ะ หนูไม่เข้าใจ
#include<stdio.h>
#define true 1
#define false 0
typedef int boolean;
struct NodeChar{ <-- ข้อ 1
char item;
struct NodeChar *next;
};
struct NodeChar *insertNode(char newItem,struct NodeChar *nextNode){ <-- ข้อ 2
struct NodeChar *newNode;
newNode = (struct NodeChar *)malloc(sizeof(struct NodeChar)); <-- ข้อ 3
newNode->item = newItem;
newNode->next = nextNode;
return(newNode);
}
void printlist (struct NodeChar *head){ <-- ข้อ 4
struct NodeChar *curr;
curr = head;
while (curr != NULL){ <-- ข้อ 5
printf("%d\t",curr->item);
curr = curr->next;
}
}
struct NodeChar *top = NULL;
boolean isEmpty(){ <-- ข้อ 6
if(top == NULL)
return true;
else return false;
}
void push(char newItem){ <-- ข้อ 7
top = insertNode(newItem,top);
}
char pop(){ <-- ข้อ 8
if(isEmpty() == false){ <-- ข้อ 9
struct NodeChar *temp = top
top = top->next;
return temp->item;
}else return '1';
}
char peek(){ <-- ข้อ 10
if(isEmpty == false){
return top->item;
}return -1;
}
ใครพออธิบายได้ก็ขอรบกวนด้วยนะค้าาาา
ขอบคุณมากค่าาาา