พอดีว่า อ.หนูให้อธิบายโค้ดด้านล่างนี้อ่ะค่ะ ตามหมายเลขเลย 1 ถึง 10
รบกวนช่วยอธิบายหน่อยค่ะ หนูไม่เข้าใจ
#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;
}
ใครพออธิบายได้ก็ขอรบกวนด้วยนะค้าาาา
ขอบคุณมากค่าาาา																															
						 
												
						
					
รบกวนปรมจารย์ด้านภาษาซี ช่วยมาอธิบายโค้ดนี้ทีค่ะ 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;
}
ใครพออธิบายได้ก็ขอรบกวนด้วยนะค้าาาา
ขอบคุณมากค่าาาา