Complete the code to declare a pointer to an integer.
int [1] ptr;The asterisk (*) is used to declare a pointer variable in C.
Complete the code to assign the address of variable 'a' to pointer 'ptr'.
int a = 10; int *ptr; ptr = [1]a;
The ampersand (&) operator gives the address of a variable in C.
Fix the error in the code to correctly print the value pointed by 'ptr'.
int a = 5; int *ptr = &a; printf("%d", [1]);
Using *ptr accesses the value stored at the address the pointer points to.
Fill both blanks to create a pointer to an integer and assign it the address of variable 'num'.
int num = 20; [1] ptr; ptr = [2]num;
To declare a pointer to int, use 'int *'. To assign address, use '&'.
Fill all three blanks to create a pointer, assign it the address of 'val', and print the value using the pointer.
int val = 30; [1] ptr; ptr = [2]val; printf("%d", [3]ptr);
Declare pointer with 'int *', assign address with '&', and dereference with '*'.