0
0
Cprogramming~10 mins

Pointer declaration - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to declare a pointer to an integer.

C
int [1] ptr;
Drag options to blanks, or click blank then click option'
A*
B&
C#
D%
Attempts:
3 left
💡 Hint
Common Mistakes
Using & instead of * to declare a pointer.
Forgetting the * symbol entirely.
2fill in blank
medium

Complete the code to declare a pointer to a character.

C
char [1] ch_ptr;
Drag options to blanks, or click blank then click option'
A&
B$
C^
D*
Attempts:
3 left
💡 Hint
Common Mistakes
Using & instead of * for pointer declaration.
Using symbols like ^ or $ which are invalid here.
3fill in blank
hard

Fix the error in the pointer declaration.

C
float [1] ptr;
Drag options to blanks, or click blank then click option'
A*
B#
C&
D@
Attempts:
3 left
💡 Hint
Common Mistakes
Placing & instead of *.
Using invalid symbols like # or @.
4fill in blank
hard

Fill both blanks to declare a pointer to a double and initialize it to NULL.

C
double [1] ptr = [2];
Drag options to blanks, or click blank then click option'
A*
BNULL
C0
D&
Attempts:
3 left
💡 Hint
Common Mistakes
Using 0 instead of NULL for pointer initialization.
Using & instead of * for pointer declaration.
5fill in blank
hard

Fill all three blanks to declare a pointer to a constant integer and initialize it to NULL.

C
const int [1] ptr = [2]; // pointer to constant int

[3] value = 10;
Drag options to blanks, or click blank then click option'
A*
BNULL
Cint
D&
Attempts:
3 left
💡 Hint
Common Mistakes
Using & instead of * for pointer declaration.
Using wrong variable type for value.
Initializing pointer with 0 instead of NULL.