#include <stdio.h>
int main()
{
int *numPtr;
int num1 = 10;
int num2 = 20;
① ________________
printf("%d\n", *numPtr);
②_________________
printf("%d\n", *numPtr);
return 0;
}
실행 결과
10
20
Solution
① numPtr = &num1;
② numPtr = &num2;
Exercise 2
int x =10;
double y=2.5;
int *ptrX = &x;
int *ptrY = &y;
/*
-Print the address of variable ‘x’
-Print the address of variable ‘y’
-Print the value of pointer ‘ptrX ‘
-Print the address of pointer ‘ptrX ‘
-Print the size of pointer ‘ptrX ‘
*/
/*
-Print the value of pointer ‘ptrY ‘
-Print the address of pointer ‘ptrY ‘
-Print the size of pointer ‘ptrY
*/
Exercise 3 - for EC only
int x =10;
double y=2.5;
int *ptrX = &x;
int *ptrY = &y;
// Typecast pointer 'ptrY' to as (double *)