C クイズ: Pointer Basics

This C quiz checks the first ideas about pointers - what & and * do, how a pointer lets a function change the caller's variable and why NULL must be checked. It is for learners who have just met pointers and want to make them click.

やさしい 10問 約5分 合格ライン 80% C17

モードを選ぶ

ゲストとしてプレイ中です。ログインすると XP と連続記録が保存されます。

例題

第1問 / 全10問

What does this print?

#include <stdio.h>

int main(void) {
    int x = 5;
    int *p = &x;
    *p = 8;
    printf("%d\n", x);
    return 0;
}
答えを見る

B. 8 p holds the address of x, so *p = 8 writes 8 into x itself. There is only one integer here, reached under two names.

このクイズの内容

  • &x gives an address, *p follows it
  • Changing a variable through a pointer
  • Passing pointers so a function can modify its arguments
  • Comparing pointers vs comparing the values they point to
  • NULL and the int* a, b trap

よくある質問

アカウントは必要ですか?

いいえ、誰でも遊べます。ログインすると XP、連続記録、バッジ、履歴が保存されます。

何度でも挑戦できますか?

はい。ベストスコアが記録され、問題と選択肢は毎回シャッフルされます。