File tree Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -136,3 +136,19 @@ main()
136136}
137137```
138138Though the memory has been deallocated by free(ptr), the pointer to integer ptr still points to that unreserved memory address
139+
140+ ## Pointer Arithmetic
141+ We know by now that pointers are not like any other variable. They do not store any value but the address of memory blocks.
142+
143+ So it should be quite clear that not all arithmetic operations would be valid with them.
144+
145+ ** Pointers have few but immensely useful valid operations:**
146+
147+ 1 . You can assign the value of one pointer to another only if they are of the same type (unless they're typecasted or one of them is void * ).
148+ ``` c
149+ int ManU = 1 ;
150+ int *addressOfManU = &ManU;
151+ int *anotherAddressOfManU = NULL ;
152+ anotherAddressOfManU = addressOfManU; /* Valid */
153+ double *wrongAddressOfManU = addressOfManU; /* Invalid */
154+ ```
You can’t perform that action at this time.
0 commit comments