-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathC7E1PointerVariable.c
29 lines (20 loc) · 980 Bytes
/
C7E1PointerVariable.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
/* Challanges Ch7E1 - PointerVariable */
// By Jim-Kristian Malmhaug | Date: 2 October 2013
//Notes:
//References:
#include <stdio.h>
main() {
int *iPtr;
char *cPtr;
float *fFloat;
int iNumber = 100;
float fNumber = 0.001;
char cCharacter = 'J';
iPtr = &iNumber; //iPtr points to iNumber-adress.
cPtr = &cCharacter; //cPtr points to cChar-adress.
fFloat = &fNumber; //fFloat points to fNumber-adress.
printf("\n\nThe value of iNumber, fNumber and cCharacter is %d, %f and %c\n\n", iNumber, fNumber, cCharacter);
printf("\n\nThe value of iPtr, fFloat and cPtr is %d, %f and %c\n\n", *iPtr, *fFloat, *cPtr);
printf("\n\nThe adress of iNumber, fNumber and cCharacter is %p, %p and %p\n\n", &iNumber, &fNumber, &cCharacter);
printf("\n\nThe adress of iPtr, fFloat and cPtr is %p, %p and %p\n\n", iPtr, fFloat, cPtr);
} //End of main()-function