ts-7000
[Top] [All Lists]

[ts-7000] Re: malloc()

To:
Subject: [ts-7000] Re: malloc()
From: "Phil" <>
Date: Wed, 25 Oct 2006 15:31:38 -0000
Hi Jason,

No, pointers always have types, or more correctly, pointers *are* 
types. But I guess to answer your question, there are many different 
pointer types. One of the reasons (among many) that this has to be the 
case is as follows..


char        *charPtr;
short int   *intPtr;

charPtr = (char *) 123;
intPtr  = (short int *) 123;

// At this point both variable are holding the value 123.

charPtr++;
intPtr++;

// Now charPtr == 124 *but* intPtr == 125


But there are various other reasons. Hope this helps.

Cheers
Phil


--- In  Jason Stahls <> wrote:
>
> Ok, I had this working for a while then started mucking and broke it 
> again.  Question is, why are you casting the returns to char *, I've 
> always understood that a pointer is a pointer, it has no type, am I 
wrong?
> 
> Jason





 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/ts-7000/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/ts-7000/join
    (Yahoo! ID required)

<*> To change settings via email:
     
    

<*> To unsubscribe from this group, send an email to:
    

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 

<Prev in Thread] Current Thread [Next in Thread>
Admin

Disclaimer: Neither Andrew Taylor nor the University of NSW School of Computer and Engineering take any responsibility for the contents of this archive. It is purely a compilation of material sent by many people to the birding-aus mailing list. It has not been checked for accuracy nor its content verified in any way. If you wish to get material removed from the archive or have other queries about the archive e-mail Andrew Taylor at this address: andrewt@cse.unsw.EDU.AU