-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathreference.c
More file actions
29 lines (21 loc) · 740 Bytes
/
Copy pathreference.c
File metadata and controls
29 lines (21 loc) · 740 Bytes
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
#include <stdio.h>
#include <stdarg.h>
/*
In C, references or pointers are used for
* strings
* dynamic memory allocation
* sending function arguments by reference
* building complicated data structures
a pointer is essentially a simple integer variable which holds a memory address that points to a value
the computer's memory is a sequential store of data, and a pointer points to a specific part of the memory
*/
int main ()
{
/* dereferencing a pointer is done by using * */
int a = 1;
/* define a pointer variable, and point it to a using & */
int * pointer_to_a = &a;
printf("The value of a is %d\n", a);
printf("The value of a using the pointer is %d\n", *pointer_to_a);
return 0;
}