We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Hi, I observed a strange behaviour (for me only) of void pointer. I wrote a code to access an integer through void pointer as below:
void *ptr; int a[2] = {1,2};
ptr = (int *)&a; ptr++; // This is giving error: Unknown Size
Why the above increment statement is giving error as i already cast the pointer to int type ?
Can anybody help me in understanding this ?
Karthik K.
Thanks Drew, I am new to C and forum posts such as this void pointer one help me learn. I searched the web for C99 and did find some examples so at least understand what it is. I will use some bits of it from now on. But at my present level of C knowlewdge will not try to do more than this.
I am struggling with multi-dimensional char arrays, pointer etc right now and am getting some odd results, but I will persevere!
"persevere!",
HOW loong can you persevere without the chip indicating ANYthing, red or green or any thing on the led?
"I am new to C ... I am struggling with multi-dimensional char arrays, pointer etc"
You might find it easier to get to grips with such issues on a PC; then, once you've mastered the language, you can move on to applying it in the specialist world of embedded microcontrollers...
Your right, but I like to see things happening! I do know assembly fairly well, and have used Forth for embedded. In fact I compared Arm Forth to Keil, but decided to go with C because I wanted to broaden my horizon and I have the opportunity (time) to do it.
" but I like to see things happening! "
yaaa, but your chip may not get 'signal' iN the Target Board, and could be 'signal' problem or Power not ON. Have you checked?