C/C++の宿題を片付けます 77代目
■ このスレッドは過去ログ倉庫に格納されています
0057デフォルトの名無しさん
2006/11/21(火) 23:59:00下のプログラムに付け足して以下のプログラムを作成せよ。
繰り返し構文を用いて、リストの先頭から順番に学籍番号と数学の点数を
表示する。
・リストを先頭からたどっていくポインタst_pを宣言して使用し、まず
st_p = st_firstとする。
・リストの最後ではnext == NULLとし、これを利用する。
#include<stdio.h>
struct student{
char g[8]; /*学籍番号*/
int x; /*数学の点数*/
struct student *next
};
int main(void){
struct student *st_a, st_b;
struct student *st_first;
st_a = (struct student *)malloc(sizeof(struct student));
st_b = (struct student *)malloc(sizeof(struct student));
/*値の代入部は省略*/
st_first = st_a;
st_a->next = st_b;
st_b->next = NULL;
[3] 環境
[3.1] OS: Linux
[3.2] コンパイラ名とバージョン: gcc
[3.3] 言語: C
[4] 期限: 明日の朝10時
■ このスレッドは過去ログ倉庫に格納されています