1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

string in an array

Discussion in 'C' started by Alex, Apr 12, 2009.

  1. Alex

    Alex New Member

    Oct 1, 2006
    Likes Received:
    Trophy Points:
    I have a doutb about allocating memory and storing a string inside it.
    It may sound a very stupid question, but I need to clear it...
    My doubt comes when declaring a array bigger than the string it is
    going to be stored inside it:
    char* array = malloc( sizeof(char)*1024 );
    strcpy( array, "hello" );

Share This Page