Solved

Question For Alexo = casting to change a void pointer

Posted on 2000-03-21
2
242 Views
Last Modified: 2010-04-15
Alexo,

Does this look right?  I want to assign a pointer the value of a void pointer.  The void pointer is the same structure type as the known pointer:

void PrintOwnerList(struct List *list)
{
// pointer to the ListNode head
struct ListNode *p = list->head;
// used to assign the value of void *RecordPtr
      struct Owner *OwnPtr;

//struct Owner *OwnPtr)p->RecordPtr;

      while(p){
      // assign Owner ptr the value of the void pointer
            OwnPtr = (struct Owner*)p->RecordPtr;
            printf("Last name is %s \n", OwnPtr->Last);
            // advance CurPtr to next ListNode
            p = p->next;
      }
      return;
}

Alexo's respons:

You forgot to set p->RecordPtr = DataPointer on the 1st item.

Thanks!



0
Comment
Question by:John500
2 Comments
 
LVL 11

Accepted Solution

by:
alexo earned 50 total points
ID: 2642241
Have fun!
0
 

Author Comment

by:John500
ID: 2648993
Thanks, I forgot to answer this...
0

Featured Post

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Preface I don't like visual development tools that are supposed to write a program for me. Even if it is Xcode and I can use Interface Builder. Yes, it is a perfect tool and has helped me a lot, mainly, in the beginning, when my programs were small…
Windows programmers of the C/C++ variety, how many of you realise that since Window 9x Microsoft has been lying to you about what constitutes Unicode (http://en.wikipedia.org/wiki/Unicode)? They will have you believe that Unicode requires you to use…
The goal of this video is to provide viewers with basic examples to understand how to use strings and some functions related to them in the C programming language.
The goal of this video is to provide viewers with basic examples to understand how to create, access, and change arrays in the C programming language.

932 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now