Solved

Question For Alexo = casting to change a void pointer

Posted on 2000-03-21
2
245 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 50 total points
ID: 2642241
Have fun!
0
 

Author Comment

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

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

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…
Examines three attack vectors, specifically, the different types of malware used in malicious attacks, web application attacks, and finally, network based attacks.  Concludes by examining the means of securing and protecting critical systems and inf…
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.
Video by: Grant
The goal of this video is to provide viewers with basic examples to understand and use nested-loops in the C programming language.

730 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