20個のテーブルを含むリストを作成しようとしました。各テーブルには、次のものが必要です。 - 1から20のオーダーの数字。 - 各テーブルの座席数(表1-10-2座席、表11-15-4座席、表16-20-6座席); - それは占有されているかどうかを示すはずです。Cの単独リンクリストC4047
は私が
私は何かを考えるなど、私が後席のN量を持つテーブルを探すことができるように、この情報を含む占有する自由からテーブルの状態を変更、私のプログラムでは、このリストが必要私のコードでは間違っています。
警告C4047: 私は次の警告を取得しています「=」:「テーブル*」 からの間接参照のレベルが異なる「テーブル*」
私の推測では、私が行っているされ、初心者間違いと私はC.のリストのオンラインtoturialsを忘れてしまった。どんな助けも大歓迎。
#include<stdio.h>
typedef struct tableList *table;
struct table {
int numTable; // number of table
int numPeople;
int free; //0 - free; 1 - occupied
table *next;
};
int main(void) {
struct table a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t ;
a.numTable = 1; a.numPeople = 2; a.free = 0;
b.numTable = 2; b.numPeople = 2; b.free = 0;
c.numTable = 3; c.numPeople = 2; c.free = 0;
d.numTable = 4; d.numPeople = 2; d.free = 0;
e.numTable = 5; e.numPeople = 2; e.free = 0;
f.numTable = 6; f.numPeople = 2; f.free = 0;
g.numTable = 7; g.numPeople = 2; g.free = 0;
h.numTable = 8; h.numPeople = 2; h.free = 0;
i.numTable = 9; i.numPeople = 2; i.free = 0;
j.numTable = 10; j.numPeople = 2; j.free = 0;
k.numTable = 11; k.numPeople = 4; k.free = 0;
l.numTable = 12; l.numPeople = 4; l.free = 0;
m.numTable = 13; m.numPeople = 4; m.free = 0;
n.numTable = 14; n.numPeople = 4; n.free = 0;
o.numTable = 15; o.numPeople = 4; o.free = 0;
p.numTable = 16; p.numPeople = 6; p.free = 0;
q.numTable = 17; q.numPeople = 6; q.free = 0;
r.numTable = 18; r.numPeople = 6; r.free = 0;
s.numTable = 19; s.numPeople = 6; s.free = 0;
t.numTable = 20; t.numPeople = 6; t.free = 0;
a.next = &b;
b.next = &c;
c.next = &d;
d.next = &e;
e.next = &f;
g.next = &g;
h.next = &i;
i.next = &j;
j.next = &k;
k.next = &l;
l.next = &m;
m.next = &n;
n.next = &o;
o.next = &p;
p.next = &q;
q.next = &r;
r.next = &s;
s.next = &t;
t.next = NULL;
}
'typedef struct tableList * table;' tableList'とは何ですか? – Marievi
'table'型のエイリアスを定義するときに、' struct tableList'があります。そして、 'table'構造体を定義します。 'tableList'構造体はどこにありますか?また、あなたのタイプエイリアスのために、メンバーnextはポインタへのポインタ*です。 –
tableListはテーブルを持つ私のリストの名前です。 – NewbieWantsToLearn