Solved

Question For Alexo = casting to change a void pointer

Posted on 2000-03-21
2
241 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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Adjust Mfcapp 29 155
why "." vs "->" 23 116
How to jump to matching brace in eclipse editor ? 1 235
distributed computing in Python 4 99
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…
This tutorial is posted by Aaron Wojnowski, administrator at SDKExpert.net.  To view more iPhone tutorials, visit www.sdkexpert.net. This is a very simple tutorial on finding the user's current location easily. In this tutorial, you will learn ho…
The goal of this video is to provide viewers with basic examples to understand recursion in the C programming language.
Video by: Grant
The goal of this video is to provide viewers with basic examples to understand and use while-loops in the C programming language.

705 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

11 Experts available now in Live!

Get 1:1 Help Now