Thread: Need fast help!PLEASE!!

  1. #1
    Registered User
    Join Date
    May 2007

    Need fast help!PLEASE!!

    I need help with some program! I'm student on first year at Electro-tehnical enginiering.
    I have to write some program, but i dont know how to do that, because it's so hard for me.Can someone tell me how can i use pointers in C programing? What is meanins of code malloc?
    I hope so that someone will answer and help me! Thank you!

  2. #2
    Its hard... But im here swgh's Avatar
    Join Date
    Apr 2005
    have you tried a google? Or perhaps a book? There is a good tutorial on this site on pointers in C and C++ for that matter. A pointer is a variable that contains a memory address as it's value.
    Double Helix STL

  3. #3
    Deathray Engineer MacGyver's Avatar
    Join Date
    Mar 2007
    A brief view:

    As already said, a pointer is a variable that merely holds an address of a variable.

    int a = 5; /*This is a variable of type int that has a value of 5.*/
    int *p = &a; /* This is a variable of type pointer to int that has the value of the address of a.*/
    malloc() is a function that is used to allocate memory for your program on the fly at runtime. Arguments are plenty with regard to the correct way of using malloc(), but the basic idea is that you give it the amount of memory needed in bytes and it'll return to you a block of memory of that size if it is able to. If it is not able to, it returns NULL.

    int *q = malloc(sizeof(*q));
    The above code segment tries to allocate a block of memory that is just enough to hold an int, and then assigns it to q. If not enough memory was available, q will be set to NULL.

    A more detailed view:

  4. #4
    Woof, woof! zacs7's Avatar
    Join Date
    Mar 2007
    Is it me, or would they not teach you programming...?

  5. #5
    Registered User
    Join Date
    May 2007
    Thank's to everybody!! Thank's for sugestions!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 6
    Last Post: 02-27-2009, 03:43 PM
  2. I want to make a fast scroll
    By Gustaff in forum C Programming
    Replies: 3
    Last Post: 04-29-2004, 07:40 PM
  3. Saving a part of screen into a file fast!
    By Zap in forum C++ Programming
    Replies: 4
    Last Post: 06-28-2003, 10:56 AM
  4. Super fast bilinear interpolation
    By VirtualAce in forum Game Programming
    Replies: 2
    Last Post: 06-18-2002, 09:35 PM
  5. moving a bitmap, fast and smooth
    By werdy666 in forum Game Programming
    Replies: 1
    Last Post: 05-31-2002, 06:49 PM
Website Security Test