This site is no longer active and is available for archival purposes only. Registration and login is disabled.

use of calloc()


use of calloc()

Postby AnanoMouse » Mar 28, 2002 @ 5:46am

ok, I am trying to learn how to program for the ppc and I could use some help. I have been reading through some tutorials on the net on programing. Ok, here is my question.

What is the exact purpose of calloc()

and

In this case, what does the following mean...

struct Misc
{
int x;
Misc y;
}*x;

void somefunction()
{
calloc(1, x);
}

(I think that is the correct syntax, but I am not positive. Oh wise programmers, please help).
AnanoMouse
 


Postby djr2cool » Mar 28, 2002 @ 6:26am

calloc, and malloc are used to create buffers.

the first thing is a pointer to a struct *x, also looks like some sort of linked list maybe.. seeing how there is a reference to itself inside the struct..

i also didnt think calloc was used in that way.. i thought it was used more like

unsigned short *Buff = (unsigned short*)calloc(n1,n2);

n1 would be how many slots in the buffer and n2 s the size of each slot in bytes.. it may be reversed.
djr2cool
 


Postby RICoder » Mar 28, 2002 @ 6:55am

<iframe src="http://gamercard.xbox.com/RICoder.card" scrolling="no" frameBorder="0" height="140" width="204">RICoder</iframe>
User avatar
RICoder
FOX News Correspondent
 
Posts: 3948
Joined: Jul 10, 2001 @ 1:48pm
Location: the matrix has me


Return to Windows Mobile


Sort


Forum Description

A discussion forum for mobile device developers on the Windows Mobile platform. Any platform specific topics are welcome.

Moderators:

Dan East, sponge, Digby, David Horn, Kevin Gelso, RICoder

Forum permissions

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

cron