How to store result of type char in pointer?

I want to store result of type char in pointer which I’m passing as argument of function. Like this:

#include<stdio.h>
void try(char *);
int main()
{
char *result;
try(result);
printf("%s",result);
return 0;
}
void try(char *result)
{
result="try this";
}

But I’m getting result : (null)

Could someone tell me what’s wrong here?

Thank you!


Source: c#

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.