Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to assign a value to a pointer in Carbon



ai cui <email@hidden> wrote:

> my code doesn't work well in Xcode:
>
> int *p1;
> int *p2;
> *p=200; // EXC_BAD_ACCESS occur when debuging
>
>
> So, is there a real POINTER data type in Carbon?
> Why is it so weird when use it?

This has nothing to do with Carbon.

This is standard C. And if you program in C or C++, you should
understand how to use pointers.

Look up the standard C functions: malloc, free and sizeof
or the standard C++ operators: new and delete

There are also Carbon API's for allocating memory such as
NewPtr/DisposePtr and NewHandle/DisposeHandle.
But in MacOS X, it's usually better to use the standard C/C++ methods.

--
email@hidden http://www.mts.net/~gbeggs1/
_______________________________________________
carbon-development mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/carbon-development
Do not post admin requests to the list. They will be ignored.

References: 
 >How to assign a value to a pointer in Carbon (From: ai cui <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.