Need fast help!PLEASE!!

This is a discussion on Need fast help!PLEASE!! within the C Programming forums, part of the General Programming Boards category; I need help with some program! I'm student on first year at Electro-tehnical enginiering. I have to write some program, ...

  1. #1
    Registered User
    Join Date
    May 2007
    Posts
    2

    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
    Location
    England
    Posts
    1,479
    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.
    I'm just trying to be a better person - My Name Is Earl

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

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

    Code:
    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.

    Code:
    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:

    http://www.cprogramming.com/tutorial/c/lesson6.html

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

  5. #5
    Registered User
    Join Date
    May 2007
    Posts
    2
    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, 04:43 PM
  2. I want to make a fast scroll
    By Gustaff in forum C Programming
    Replies: 3
    Last Post: 04-29-2004, 08: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, 11:56 AM
  4. Super fast bilinear interpolation
    By VirtualAce in forum Game Programming
    Replies: 2
    Last Post: 06-18-2002, 10:35 PM
  5. moving a bitmap, fast and smooth
    By werdy666 in forum Game Programming
    Replies: 1
    Last Post: 05-31-2002, 07:49 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21