Jump to content

Memory Management

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
4 replies to this topic

#1
batwings

batwings

    Newbie

  • Members
  • Pip
  • 2 posts
Hello Guys !
I'm new user of C, I've been using it for a couple of months.
I have a question about the use of the comands to allocate and handle memory resources.

Like memset, malloc, and all these commands.

The question is when is necessary to start using them.

When we have very large arrays? Or we handle big amounts of information?

Thanks for the support.

Regards..

#2
dcs

dcs

    Programming God

  • Members
  • PipPipPipPipPipPipPip
  • 775 posts
Yes. When you need them is when you need them.

And memset doesn't have anything to do with allocation.

#3
batwings

batwings

    Newbie

  • Members
  • Pip
  • 2 posts
Thanks.
I've read that malloc is just to reserve a block of memory and memset is to manipulate that range of memory.

Right?

Regards..

#4
dcs

dcs

    Programming God

  • Members
  • PipPipPipPipPipPipPip
  • 775 posts
Sure. a = 4 manipulates a block of memory too.

#5
WingedPanther

WingedPanther

    A spammer's worst nightmare

  • Moderators
  • 16,831 posts
Generally, you will use pointers when creating more advanced data structures (such as linked lists), to "pass by reference" instead of "pass by value", and when you are passing large structs into functions.
Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog