#pragma warning(disable:4996)
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
typedef struct NODE { char name[21]; int grade; struct NODE *next; } NODE;
NODE *getnode(char *name, int grade) {
NODE *newnode = (NODE *)malloc(sizeof(NODE));
newnode->next = NULL;
strcpy(newnode->name, name);
newnode->grade = grade;
return newnode;
}
int main() {
char name[21];
int grade;
NODE *L = NULL, *newnode;
NODE*ptr, *tmp;
while (1) {
// name 입력받고 0이면 break;
//제일 처음이면 L== NULL일 것.
gets_s(name);
if (strcmp(name, "0") == 0) break;
scanf("%d", &grade);
getchar();
if (L == NULL) L = getnode(name, grade);
else {
newnode = getnode(name, grade);
newnode->next = L;
L = newnode;
}
}
for (ptr = L; ptr != NULL; ptr = ptr->next) {
printf("%s %d", ptr->name, ptr->grade);
}
for (ptr = L; ptr != NULL; ) {
tmp = ptr->next;
free(ptr);
ptr = tmp;
}
return 0;
}
data_structure-in-c's Introduction
data_structure-in-c's People
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.