OUTPUT (after running):
x = 20
y = 10
a = 20
b = 10
Explanation:
Here we must understand the concept of pointers.
A pointer is a variable that holds
the memory address of another variable.
For example,
int a =10;
int *ptr = &a;
That is, ‘ptr’ is an integer pointer that holds the memory address of another integer variable, ‘a’.
We must declare a pointer variable also. Many pointer variables can be declared on a single line,
such as
int *ptr1, *ptr2, *ptr3;
We can even have an array of pointers and so on but we shall study this a bit later.
Remember the
following rule: “Always store the address of a data type into a pointer of the same data type.
We cannot store the address of a variable of one type into a pointer variable of another type.
This means that the integer pointer can hold the address of an integer variable, the float pointer
Do'stlaringiz bilan baham: |