I'm trying to insert into the front of a linked list and also return an allocated head for when head is NULL, but it seems to only work in the event that head is not NULL.
essentially, if
node* x = NULL;
is
x = addfront(x, 3)
valid?
I'm trying to insert into the front of a linked list and also return an allocated head for when head is NULL, but it seems to only work in the event that head is not NULL.
essentially, if
node* x = NULL;
is
x = addfront(x, 3)
valid?
逆参照しない限り、null ポインターは問題ありません。
何かのようなもの
node* x = NULL;
x = NULL;
全然大丈夫です。
ヌル ポインターを引数として使用してヌル ポインターに代入する関数を使用することは C で有効ですか?
内容によりaddfrontます。xで逆参照しない限りaddfront、null ポインターの逆参照は未定義の動作であるため、完全に有効です。
head が NULL でない場合にのみ機能するようです。
addfrontソースコードが必要です。を逆参照しない場合x、エラーは別の場所にあります。