Why can I not alloc memory in called function?

Discussion in 'C Programming' started by Angus, Jul 24, 2010.

  1. Angus

    Angus Guest

    Hello

    I am passing a char* pointer into a function and in the function I malloc
    but when the function returns the pointer seems to go out of scope? I
    thought that if I passed a pointer, then I would allocate memory to the
    pointer? What am I doing wrong?

    #include <stdlib.h>

    void doit(char* allostring)
    {
    allostring = malloc(6);
    memcpy(allostring, "Hello\0", 6);
    }

    int main()
    {
    char* strtopass = 0;
    doit(strtopass);

    free(strtopass);

    return 0;
    }
     
    Angus, Jul 24, 2010
    #1
    1. Advertising

  2. Angus

    osmium Guest

    Angus wrote:

    > I am passing a char* pointer into a function and in the function I
    > malloc but when the function returns the pointer seems to go out of
    > scope? I thought that if I passed a pointer, then I would allocate
    > memory to the pointer? What am I doing wrong?
    >
    > #include <stdlib.h>
    >
    > void doit(char* allostring)
    > {
    > allostring = malloc(6);
    > memcpy(allostring, "Hello\0", 6);
    > }
    >
    > int main()
    > {
    > char* strtopass = 0;
    > doit(strtopass);
    >
    > free(strtopass);
    >
    > return 0;
    > }


    Variables are passed by value in C. So doit was operating on a local *copy*
    of variable of interest. You can work around this by using pointers.
     
    osmium, Jul 24, 2010
    #2
    1. Advertising

  3. On 24 July, 14:41, "Angus" <> wrote:

    > I am passing a char* pointer into a function and in the function I malloc
    > but when the function returns the pointer seems to go out of scope?  I
    > thought that if I passed a pointer, then I would allocate memory to the
    > pointer?  What am I doing wrong?
    >
    > #include <stdlib.h>
    >
    > void doit(char* allostring)
    > {
    >     allostring = malloc(6);
    >     memcpy(allostring, "Hello\0", 6);
    >
    > }
    >
    > int main()
    > {
    >     char* strtopass = 0;
    >     doit(strtopass);
    >
    >     free(strtopass);
    >
    >     return 0;
    > }


    see the FAQ

    http://c-faq.com/ptrs/passptrinit.html
     
    Nick Keighley, Jul 24, 2010
    #3
  4. Angus

    Angus Guest

    But strtopass is a char* - so it is a pointer? In this code, am I not
    passing the address of the strtopass variable?

    I can see how to do this with eg a int* - but how do I do it with a char*?


    "osmium" <> wrote in message
    news:...
    > Angus wrote:
    >
    >> I am passing a char* pointer into a function and in the function I
    >> malloc but when the function returns the pointer seems to go out of
    >> scope? I thought that if I passed a pointer, then I would allocate
    >> memory to the pointer? What am I doing wrong?
    >>
    >> #include <stdlib.h>
    >>
    >> void doit(char* allostring)
    >> {
    >> allostring = malloc(6);
    >> memcpy(allostring, "Hello\0", 6);
    >> }
    >>
    >> int main()
    >> {
    >> char* strtopass = 0;
    >> doit(strtopass);
    >>
    >> free(strtopass);
    >>
    >> return 0;
    >> }

    >
    > Variables are passed by value in C. So doit was operating on a local
    > *copy* of variable of interest. You can work around this by using
    > pointers.
    >
    >
     
    Angus, Jul 24, 2010
    #4
  5. Angus

    Chad Guest

    On Jul 24, 6:48 am, "osmium" <> wrote:
    > Angus wrote:
    > > I am passing a char* pointer into a function and in the function I
    > > malloc but when the function returns the pointer seems to go out of
    > > scope?  I thought that if I passed a pointer, then I would allocate
    > > memory to the pointer?  What am I doing wrong?

    >
    > > #include <stdlib.h>

    >
    > > void doit(char* allostring)
    > > {
    > >    allostring = malloc(6);
    > >    memcpy(allostring, "Hello\0", 6);
    > > }

    >
    > > int main()
    > > {
    > >    char* strtopass = 0;
    > >    doit(strtopass);

    >
    > >    free(strtopass);

    >
    > >    return 0;
    > > }

    >
    > Variables are passed by value in C.  So doit was operating on a local *copy*
    > of variable of interest.  You can work around this by using pointers.


    Should would something like the following be a possible fix....

    #include <stdio.h>
    #include <stdlib.h>
    #include <string.h>

    char* doit(char* allostring)
    {
    allostring = malloc(6);
    memcpy(allostring, "Hello\0", 6);
    return allostring;
    }

    int main(void)
    {
    char* strtopass = 0;
    strtopass = doit(strtopass);

    printf("%s\n", strtopass);
    free(strtopass);

    return 0;

    }
     
    Chad, Jul 24, 2010
    #5
  6. Angus

    Fishy Guest

    >
    > #include <stdio.h>
    > #include <stdlib.h>
    > #include <string.h>
    >
    > char* doit(char* allostring)
    > {
    >   allostring = malloc(6);
    >   memcpy(allostring, "Hello\0", 6);
    >   return allostring;
    >
    > }
    >
    > int main(void)
    > {
    >   char* strtopass = 0;
    >   strtopass = doit(strtopass);
    >
    >   printf("%s\n", strtopass);
    >   free(strtopass);
    >
    >   return 0;
    >
    > }
    >
    >


    This does solve the problem in case it is limited to only memory
    location only. If one intends to do the same with several locations
    then following would help.

    void doit(char ** allostring)
    {
    *allostring = malloc(6);
    memcpy(*allostring, "Hello\0", 6);
    }

    int main()
    {
    char *strtopass = 0;
    doit(&strtopass);

    printf("%s\n",strtopass);

    free(strtopass);

    return 0;
    }
     
    Fishy, Jul 24, 2010
    #6
  7. Angus

    Angus Guest

    Hi

    Yes I noticed that does work, but sometimes you might want to pass in say
    two paramaters in this way.

    If I use same function char* doit(char* allostring) but call it like this:
    doit(strtopass);

    Then it does not work. How would I write the function for the string to
    refer to the passed address in memory after the function returns?

    It must be possible, because if I do this:

    void addthree(int* i)
    {
    *i +=3;
    }

    And call like this:
    int num = 0;
    addthree(&num);

    Then num = 3 after the function returns.

    So how do I do that for a char*?

    Angus


    "Chad" <> wrote in message
    news:...
    On Jul 24, 6:48 am, "osmium" <> wrote:
    > Angus wrote:
    > > I am passing a char* pointer into a function and in the function I
    > > malloc but when the function returns the pointer seems to go out of
    > > scope? I thought that if I passed a pointer, then I would allocate
    > > memory to the pointer? What am I doing wrong?

    >
    > > #include <stdlib.h>

    >
    > > void doit(char* allostring)
    > > {
    > > allostring = malloc(6);
    > > memcpy(allostring, "Hello\0", 6);
    > > }

    >
    > > int main()
    > > {
    > > char* strtopass = 0;
    > > doit(strtopass);

    >
    > > free(strtopass);

    >
    > > return 0;
    > > }

    >
    > Variables are passed by value in C. So doit was operating on a local
    > *copy*
    > of variable of interest. You can work around this by using pointers.


    Should would something like the following be a possible fix....

    #include <stdio.h>
    #include <stdlib.h>
    #include <string.h>

    char* doit(char* allostring)
    {
    allostring = malloc(6);
    memcpy(allostring, "Hello\0", 6);
    return allostring;
    }

    int main(void)
    {
    char* strtopass = 0;
    strtopass = doit(strtopass);

    printf("%s\n", strtopass);
    free(strtopass);

    return 0;

    }
     
    Angus, Jul 24, 2010
    #7
  8. Angus

    Angus Guest

    I thought I had tried that.

    Yes that works. thanks.


    "Fishy" <> wrote in message
    news:...
    >
    > #include <stdio.h>
    > #include <stdlib.h>
    > #include <string.h>
    >
    > char* doit(char* allostring)
    > {
    > allostring = malloc(6);
    > memcpy(allostring, "Hello\0", 6);
    > return allostring;
    >
    > }
    >
    > int main(void)
    > {
    > char* strtopass = 0;
    > strtopass = doit(strtopass);
    >
    > printf("%s\n", strtopass);
    > free(strtopass);
    >
    > return 0;
    >
    > }
    >
    >


    This does solve the problem in case it is limited to only memory
    location only. If one intends to do the same with several locations
    then following would help.

    void doit(char ** allostring)
    {
    *allostring = malloc(6);
    memcpy(*allostring, "Hello\0", 6);
    }

    int main()
    {
    char *strtopass = 0;
    doit(&strtopass);

    printf("%s\n",strtopass);

    free(strtopass);

    return 0;
    }
     
    Angus, Jul 24, 2010
    #8
  9. Angus

    osmium Guest

    "Angus" wrote:

    > Yes I noticed that does work, but sometimes you might want to pass in say
    > two paramaters in this way.
    >
    > If I use same function char* doit(char* allostring) but call it like
    > this:
    > doit(strtopass);
    >
    > Then it does not work. How would I write the function for the string to
    > refer to the passed address in memory after the function returns?
    >
    > It must be possible, because if I do this:
    >
    > void addthree(int* i)
    > {
    > *i +=3;
    > }
    >
    > And call like this:
    > int num = 0;
    > addthree(&num);
    >
    > Then num = 3 after the function returns.
    >
    > So how do I do that for a char*?
    >
    > Angus
    >
    >
    > "Chad" <> wrote in message
    > news:...
    > On Jul 24, 6:48 am, "osmium" <> wrote:
    >> Angus wrote:
    >> > I am passing a char* pointer into a function and in the function I
    >> > malloc but when the function returns the pointer seems to go out of
    >> > scope? I thought that if I passed a pointer, then I would allocate
    >> > memory to the pointer? What am I doing wrong?

    >>
    >> > #include <stdlib.h>

    >>
    >> > void doit(char* allostring)
    >> > {
    >> > allostring = malloc(6);
    >> > memcpy(allostring, "Hello\0", 6);
    >> > }

    >>
    >> > int main()
    >> > {
    >> > char* strtopass = 0;
    >> > doit(strtopass);

    >>
    >> > free(strtopass);

    >>
    >> > return 0;
    >> > }

    >>
    >> Variables are passed by value in C. So doit was operating on a local
    >> *copy*
    >> of variable of interest. You can work around this by using pointers.

    >
    > Should would something like the following be a possible fix....
    >
    > #include <stdio.h>
    > #include <stdlib.h>
    > #include <string.h>
    >
    > char* doit(char* allostring)
    > {
    > allostring = malloc(6);
    > memcpy(allostring, "Hello\0", 6);
    > return allostring;
    > }
    >
    > int main(void)
    > {
    > char* strtopass = 0;
    > strtopass = doit(strtopass);
    >
    > printf("%s\n", strtopass);
    > free(strtopass);
    >
    > return 0;
    >
    > }


    If you have actually read the FAQ and still have questions, please tell us
    that.

    Please put your replies at the bottom of the message you are responding to.
     
    osmium, Jul 24, 2010
    #9
  10. On Sat, 24 Jul 2010 15:07:32 +0100, "Angus" <> wrote:

    >But strtopass is a char* - so it is a pointer? In this code, am I not
    >passing the address of the strtopass variable?


    Please don't top post.

    Read the reply again, especially the first sentence. It answers your
    question before you asked it.

    >
    >I can see how to do this with eg a int* - but how do I do it with a char*?
    >
    >
    >"osmium" <> wrote in message
    >news:...
    >> Angus wrote:
    >>
    >>> I am passing a char* pointer into a function and in the function I
    >>> malloc but when the function returns the pointer seems to go out of
    >>> scope? I thought that if I passed a pointer, then I would allocate
    >>> memory to the pointer? What am I doing wrong?
    >>>
    >>> #include <stdlib.h>
    >>>
    >>> void doit(char* allostring)
    >>> {
    >>> allostring = malloc(6);
    >>> memcpy(allostring, "Hello\0", 6);
    >>> }
    >>>
    >>> int main()
    >>> {
    >>> char* strtopass = 0;
    >>> doit(strtopass);
    >>>
    >>> free(strtopass);
    >>>
    >>> return 0;
    >>> }

    >>
    >> Variables are passed by value in C. So doit was operating on a local
    >> *copy* of variable of interest. You can work around this by using
    >> pointers.
    >>
    >>

    >


    --
    Remove del for email
     
    Barry Schwarz, Jul 24, 2010
    #10
  11. Angus

    Ike Naar Guest

    In article <n4C2o.346589$Hs4.110873@hurricane>, Angus <> wrote:
    > allostring = malloc(6);
    > memcpy(allostring, "Hello\0", 6);


    malloc can fail, and return NULL. You should check for this.

    String constants already contain the zero terminator.
    "Hello" is the 6-byte char array {'H','e','l','l','o','\0'},
    "Hello\0" is the 7-byte char array {'H','e','l','l','o','\0','\0'}.
    There is no good reason to use "Hello\0" instead of the simpler "Hello".

    Avoid magic numbers, and leave byte counting to the compiler.
    That way, if you ever decide to change "Hello" to "Hi", or to "Buon giorno",
    you won't have to change 6 to some other constant in several places.

    A probably more robust way to write the code fragment is:

    char const hello[] = "Hello";
    allostring = malloc(sizeof hello);
    if (allostring != NULL)
    strcpy(allostring, hello);

    --

    SDF Public Access UNIX System - http://sdf.lonestar.org
     
    Ike Naar, Jul 24, 2010
    #11
  12. Angus

    osmium Guest

    "Ike Naar" wrote:

    > In article <n4C2o.346589$Hs4.110873@hurricane>, Angus <>
    > wrote:
    >> allostring = malloc(6);
    >> memcpy(allostring, "Hello\0", 6);

    >
    > malloc can fail, and return NULL. You should check for this.
    >
    > String constants already contain the zero terminator.
    > "Hello" is the 6-byte char array {'H','e','l','l','o','\0'},
    > "Hello\0" is the 7-byte char array {'H','e','l','l','o','\0','\0'}.
    > There is no good reason to use "Hello\0" instead of the simpler "Hello".
    >
    > Avoid magic numbers, and leave byte counting to the compiler.
    > That way, if you ever decide to change "Hello" to "Hi", or to "Buon
    > giorno",
    > you won't have to change 6 to some other constant in several places.
    >
    > A probably more robust way to write the code fragment is:
    >
    > char const hello[] = "Hello";
    > allostring = malloc(sizeof hello);
    > if (allostring != NULL)
    > strcpy(allostring, hello);


    Well, if you are on a robustness kick, might it be a good idea for the
    function to inform the caller, or somebody, when the function fails to do
    what it was supposed to do?
     
    osmium, Jul 24, 2010
    #12
  13. Angus

    Ike Naar Guest

    In article <>,
    osmium <> wrote:
    > [...]
    >> In article <n4C2o.346589$Hs4.110873@hurricane>, Angus <>
    >> wrote:
    >>> allostring = malloc(6);
    >>> memcpy(allostring, "Hello\0", 6);

    > [...]
    >Well, if you are on a robustness kick, might it be a good idea for the
    >function to inform the caller, or somebody, when the function fails to do
    >what it was supposed to do?


    Yes, of course. But, in this case, this information comes for free.

    The function, as written by the OP, does nothing useful (well, it
    leaks some memory), but others have already explained how that can
    be fixed. If those fixes are applied, the caller can detect that
    a malloc failure occurred by looking at the function's output,
    which, in that case, is NULL.
    --

    SDF Public Access UNIX System - http://sdf.lonestar.org
     
    Ike Naar, Jul 24, 2010
    #13
  14. Angus

    osmium Guest

    "Ike Naar" wrote:

    > In article <>,
    > osmium <> wrote:
    >> [...]
    >>> In article <n4C2o.346589$Hs4.110873@hurricane>, Angus <>
    >>> wrote:
    >>>> allostring = malloc(6);
    >>>> memcpy(allostring, "Hello\0", 6);

    >> [...]
    >>Well, if you are on a robustness kick, might it be a good idea for the
    >>function to inform the caller, or somebody, when the function fails to do
    >>what it was supposed to do?

    >
    > Yes, of course. But, in this case, this information comes for free.
    >
    > The function, as written by the OP, does nothing useful (well, it
    > leaks some memory), but others have already explained how that can
    > be fixed. If those fixes are applied, the caller can detect that
    > a malloc failure occurred by looking at the function's output,
    > which, in that case, is NULL.


    So it is your belief that error reporting is sufficient if the user can
    deduce that the proper side effects occurred?

    Please elaborate.
     
    osmium, Jul 24, 2010
    #14
  15. On 24 Jul 2010 09:55, Angus wrote:
    > Hi


    Stop top-posting. I've corrected the remainder of your reply.

    > "Chad" <> wrote in message
    > news:...
    >> On Jul 24, 6:48 am, "osmium" <> wrote:
    >>> Angus wrote:
    >>>> I am passing a char* pointer into a function and in the function I
    >>>> malloc but when the function returns the pointer seems to go out of
    >>>> scope? I thought that if I passed a pointer, then I would allocate
    >>>> memory to the pointer? What am I doing wrong?
    >>>>
    >>>> [code removed]
    >>>
    >>> Variables are passed by value in C. So doit was operating on a local
    >>> *copy* of variable of interest. You can work around this by using
    >>> pointers.

    >>
    >> Should would something like the following be a possible fix....
    >>
    >> [code removed]

    >
    > Yes I noticed that does work, but sometimes you might want to pass in say
    > two paramaters in this way.


    If your function needs two "output" parameters, it is almost certain
    that you've designed the function incorrectly.

    > If I use same function char* doit(char* allostring) but call it like this:
    > doit(strtopass);
    >
    > Then it does not work.


    No, it will not. You've already been told why: you are passing in the
    _value_ of strtopass, not a _pointer_ to strtopass.

    > How would I write the function for the string to
    > refer to the passed address in memory after the function returns?
    >
    > It must be possible, because if I do this:
    >
    > void addthree(int* i)
    > {
    > *i +=3;
    > }
    >
    > And call like this:
    > int num = 0;
    > addthree(&num);
    >
    > Then num = 3 after the function returns.
    >
    > So how do I do that for a char*?


    You do it the exact same way:

    #include <stdlib.h>

    void doit(char** allostring) {
    *allostring = malloc(6);
    memcpy(*allostring, "Hello\0", 6);
    }

    int main() {
    char* strtopass = 0;
    doit(&strtopass);
    free(strtopass);
    return 0;
    }

    However, the use of "output" parameters does not follow C conventions
    and should be avoided when possible; it is more idiomatic to write:

    #include <stdlib.h>

    char* doit() {
    char *allostring = malloc(6);
    memcpy(allostring, "Hello\0", 6);
    return allostring;
    }

    int main() {
    char* strtopass = doit();
    free(strtopass);
    return 0;
    }


    S

    --
    Stephen Sprunk "God does not play dice." --Albert Einstein
    CCIE #3723 "God is an inveterate gambler, and He throws the
    K5SSS dice at every possible opportunity." --Stephen Hawking
     
    Stephen Sprunk, Jul 24, 2010
    #15
  16. Angus

    Eric Sosman Guest

    On 7/24/2010 5:01 PM, Stephen Sprunk wrote:
    > [...]
    > However, the use of "output" parameters does not follow C conventions
    > and should be avoided when possible; it is more idiomatic to write:
    >
    > #include<stdlib.h>
    >
    > char* doit() {
    > char *allostring = malloc(6);
    > memcpy(allostring, "Hello\0", 6);


    Note the "output parameter" in this call. It's possible, I
    guess, for a Standard library function to have an unconventional
    interface, but I see nothing unconventional about the first
    arguments of memcpy, strcpy, strcat, sprintf, qsort, ... A case
    could be made that setjmp is unconventional and that the "%n"
    conversion specifier is unusual -- but there seem to be enough
    output parameters floating around that they could hold their own
    convention and nominate their own candidates ...

    (Also, if it's "more idiomatic" to omit checking malloc's
    value for NULL, and "more idiomatic" to copy strings with hand-
    counted memcpy than with strcpy, then I think a "t" has been
    omitted somewhere.)

    --
    Eric Sosman
    lid
     
    Eric Sosman, Jul 24, 2010
    #16
  17. On 24/07/10 14:41, Angus wrote:

    > I am passing a char* pointer into a function and in the function I malloc
    > but when the function returns the pointer seems to go out of scope? I
    > thought that if I passed a pointer, then I would allocate memory to the
    > pointer? What am I doing wrong?


    1) Failing to understand that when you pass a pointer to a function,
    it's just a variable.
    2) Failing to understand that if you want to change a variable in a
    function, you have to pass a pointer to it.
    3) Failing to understand that 2 and 3 mean that if you want to change a
    pointer in a function, you have to pass its address to the function, not it.
    4) Asking others to do your coursework.

    #include <stdlib.h>
    #include <string.h>
    #include <stdio.h>

    void d(char **a)
    {
    *a = malloc(6);
    memcpy(*a, "Hello\0", 6);
    }

    int main()
    {
    char* s = 0;
    d(&s);
    printf("%s\n",s);
    free(s);
    return 0;
    }

    Rgds

    Denis McMahon
     
    Denis McMahon, Jul 25, 2010
    #17
  18. Angus

    Ike Naar Guest

    In article <>,
    osmium <> wrote:
    >So it is your belief that error reporting is sufficient if the user can
    >deduce that the proper side effects occurred?


    If it is expected that the caller can handle the error in a better way
    than the function can, then the function should just notify the caller
    that an error occurred, and leave the handling to the caller.

    Several functions from the standard library (e.g. malloc, fopen) work just
    like that.
    --

    SDF Public Access UNIX System - http://sdf.lonestar.org
     
    Ike Naar, Jul 25, 2010
    #18
  19. Angus

    osmium Guest

    "Ike Naar" wrote:

    > In article <>,
    > osmium <> wrote:
    >>So it is your belief that error reporting is sufficient if the user can
    >>deduce that the proper side effects occurred?

    >
    > If it is expected that the caller can handle the error in a better way
    > than the function can, then the function should just notify the caller
    > that an error occurred, and leave the handling to the caller.
    >
    > Several functions from the standard library (e.g. malloc, fopen) work just
    > like that.


    No they don't! malloc returns a void*, and NULL is a legitimate value that
    can be assigned to a void*.

    In the case at hand, doit returns void, nothing in the world to do with
    void*. void means this function does not return a value. Your suggestion
    was to look at the *parameter* after the call and see if IT was null.
     
    osmium, Jul 25, 2010
    #19
  20. On Sat, 24 Jul 2010 21:04:56 -0500, "osmium" <>
    wrote:

    >"Ike Naar" wrote:
    >
    >> In article <>,
    >> osmium <> wrote:
    >>>So it is your belief that error reporting is sufficient if the user can
    >>>deduce that the proper side effects occurred?

    >>
    >> If it is expected that the caller can handle the error in a better way
    >> than the function can, then the function should just notify the caller
    >> that an error occurred, and leave the handling to the caller.
    >>
    >> Several functions from the standard library (e.g. malloc, fopen) work just
    >> like that.

    >
    >No they don't! malloc returns a void*, and NULL is a legitimate value that
    >can be assigned to a void*.


    Are you deliberately trying to be obtuse. The NULL value returned
    does exactly what was suggested, notify the user that the request
    failed.

    >
    >In the case at hand, doit returns void, nothing in the world to do with
    >void*. void means this function does not return a value. Your suggestion
    >was to look at the *parameter* after the call and see if IT was null.


    Are you deliberately trying to be obtuse? There are numerous ways for
    a function to notify the caller that a problem occurred. It need not
    be the value in a return statement.

    The actual suggestion was "The function, as written by the OP, does
    nothing useful (well, it leaks some memory), but others have already
    explained how that can be fixed. If those fixes are applied, the
    caller can detect that a malloc failure occurred by looking at the
    function's output, which, in that case, is NULL." The fixes referred
    to changed the calling argument to the address of the pointer and
    changed the function to store the value returned by malloc in that
    pointer. So while the function returns nothing in the sense of a
    return statement, it certainly does have output which is immediately
    available to the calling function. Just as with malloc, a NULL value
    in this pointer would inform the calling function of a problem.

    --
    Remove del for email
     
    Barry Schwarz, Jul 25, 2010
    #20
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Bob
    Replies:
    1
    Views:
    620
    .NET Follower
    Feb 13, 2004
  2. B. Gandhi

    Memory Alloc/Dealloc query

    B. Gandhi, Sep 23, 2003, in forum: C Programming
    Replies:
    6
    Views:
    614
    Peter Shaggy Haywood
    Sep 25, 2003
  3. Mr. SweatyFinger
    Replies:
    2
    Views:
    2,129
    Smokey Grindel
    Dec 2, 2006
  4. Vulcan Fire

    string vs const int memory alloc

    Vulcan Fire, Apr 12, 2005, in forum: C Programming
    Replies:
    6
    Views:
    650
    Vulcan Fire
    Apr 19, 2005
  5. Ryan Wang

    Memory alloc for a Function

    Ryan Wang, Nov 14, 2005, in forum: C Programming
    Replies:
    10
    Views:
    626
    Dik T. Winter
    Nov 15, 2005
Loading...

Share This Page