Help: Find problem from the code

I have to find a problem in this file, but I can't find it. Please help me and explain what's the problem. Thank you in advance.

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

char *
test(char *str)
{
char *p;

p = strdup(str);
if(p)
printf("result: %s\n", p);
return p;
}

int
main(int argc, char **argv)
{
char *userstr, *p;

if(argc > 1) {
userstr = argv[1];
p = test(userstr);
}
return 0;
}

//
What is the problem? How are you running this program? You do realise it needs a command line argument, right?
Topic archived. No new replies allowed.