Dynamic allocate memory in C

label Programming
account_circle Unassigned
schedule 1 Day
account_balance_wallet $5

Can anybody help me fix my code?

#include<stdio.h>

void main()

{

    char *temp;

    temp=(char *)(80+1);

    printf("Enter your favourite movie: ");

    scanf("%[^\n]s",&temp);

    printf("\nYour favoutite movie is: %s\n",temp);

}

Thank you.

Dec 3rd, 2014

you can try 

&temp instead of temp in last printf statement 

Thank you.

Dec 4th, 2014

Did you know? You can earn $20 for every friend you invite to Studypool!
Click here to
Refer a Friend
...
Dec 3rd, 2014
...
Dec 3rd, 2014
Sep 25th, 2017
check_circle
Mark as Final Answer
check_circle
Unmark as Final Answer
check_circle
Final Answer

Secure Information

Content will be erased after question is completed.

check_circle
Final Answer