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

Returning *char problem

Discussion in 'C' started by danguba, Apr 10, 2008.

  1. danguba

    danguba New Member

    Joined:
    Apr 10, 2008
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    0
    Hello everybody... I'm new here. I have strange problem. My code look something like this

    char* point(transform z){
    char *a;
    ...
    //here goes some code where a gates some content
    ...
    printf("%s",a);
    return a;
    }
    void main()
    {
    ...
    // here goes some declarations that doesn't affect this problem
    ...
    char *p=point(y);
    printf(" %s ", p);
    }

    so first printf (where i print a) give good result but the second (where I print p) just write some strange symbol. I don't see any mistake in my code. Can anyone help?
     

Share This Page