I need to mix pointers and integers, but can't figure out how to do it, so if any caritative soul can help me in here I'll really really appreciate it.
How should I cast things in here?
At the end is what I'd like to do.
TIA & Regards ...
Expand|Select|Wrap|Line Numbers
- #include <stdlib.h>
- typedef long myinteger;
- typedef myinteger *mypointer;
- main()
- {
- mypointer p;
- myinteger myiTest;
- p=malloc(100);
- // Now I want to put in place 3 of p, a pointer to place 7 of p
- p[3]=(myinteger)p+7;
- // Now I want to put in the place pointed by p[3] a pointer to place 11 of p
- *(p[3])=p+11;
- // Now I want to put in the place pointed by the place pointed by p3 a number: 2
- *(*(p[3]))=2;
- // Now I want to access the place pointed by the place pointed by p3
- myiTest=*(*(p[3]));
- free(p);
- }