Files
Yudong Jin 2f561d3d51 feat(ko): add the Korean online edition (#2006)
* feat(ko): add the complete Korean online edition

* Use UTF-8 for Python CI output on Windows

* Remove print-book promotion from the Korean site

* fix(ko): preserve emphasis before Korean particles
2026-10-29 03:46:43 +08:00

50 lines
972 B
C

/**
* File: vertex.h
* Created Time: 2023-10-28
* Author: krahets ([email protected])
*/
#ifndef VERTEX_H
#define VERTEX_H
#ifdef __cplusplus
extern "C" {
#endif
/* 정점 구조체 */
typedef struct {
int val;
} Vertex;
/* 생성자: 새 노드를 초기화한다 */
Vertex *newVertex(int val) {
Vertex *vet;
vet = (Vertex *)malloc(sizeof(Vertex));
vet->val = val;
return vet;
}
/* 값 배열을 정점 배열로 변환한다 */
Vertex **valsToVets(int *vals, int size) {
Vertex **vertices = (Vertex **)malloc(size * sizeof(Vertex *));
for (int i = 0; i < size; ++i) {
vertices[i] = newVertex(vals[i]);
}
return vertices;
}
/* 정점 배열을 값 배열로 변환한다 */
int *vetsToVals(Vertex **vertices, int size) {
int *vals = (int *)malloc(size * sizeof(int));
for (int i = 0; i < size; ++i) {
vals[i] = vertices[i]->val;
}
return vals;
}
#ifdef __cplusplus
}
#endif
#endif // VERTEX_H