buffet
This commit is contained in:
parent
a8ccc54052
commit
5c6d8f47dc
@ -4,16 +4,16 @@
|
|||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
||||||
struct tree {
|
struct tree {
|
||||||
char value[20];
|
char value[30];
|
||||||
struct tree* left;
|
struct tree* left;
|
||||||
struct tree* right;
|
struct tree* right;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
struct tree* read_tree(){
|
struct tree* read_tree(){
|
||||||
char buffer[20];
|
char buffer[30];
|
||||||
memset(buffer,0,20);
|
memset(buffer,0,30);
|
||||||
char* r = fgets(buffer,20,stdin);
|
char* r = fgets(buffer,30,stdin);
|
||||||
int x = strlen(buffer);
|
int x = strlen(buffer);
|
||||||
buffer[x-1]='\0';
|
buffer[x-1]='\0';
|
||||||
|
|
||||||
@ -23,7 +23,7 @@ struct tree* read_tree(){
|
|||||||
if(buffer[0] == '\0'){
|
if(buffer[0] == '\0'){
|
||||||
return node;
|
return node;
|
||||||
}
|
}
|
||||||
memcpy(node->value, buffer, 20);
|
memcpy(node->value, buffer,30);
|
||||||
if(buffer[0] != '*'){
|
if(buffer[0] != '*'){
|
||||||
if(node->left == NULL){
|
if(node->left == NULL){
|
||||||
node->left = read_tree();
|
node->left = read_tree();
|
||||||
|
Loading…
Reference in New Issue
Block a user