Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Question For Alexo = casting to change a void pointer

Posted on 2000-03-21
2
Medium Priority
?
248 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 11

Accepted Solution

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

Author Comment

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

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

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 opening and reading files in the C programming language.

609 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