Please Help Me What's wrong with this code?

#include <stdio.h>

void
test(char *str)
{
printf(str);
}

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

if(argc > 1) {
userstr = argv[1];
test(userstr);
}
return 0;
}
It'd help if we knew what you were having problems with. :/

A little warning, though, is that printf expects a const char* as its first argument.

-Albatross
char* can be implicitly cast to a const char*, Alby. Just not the other way around ;P

Anyway I don't immediately see anything wrong with this code either. What makes you think something is wrong with it?
Topic archived. No new replies allowed.