i was looking at a program someone wrote.
I saw something like that:
name = (char*) strdup(path);

strdup already returns char *, so why do we need casting here?
did he do a wrong thing or am i wrong?

He didn't do anything "wrong" as such, but there isn't any need to cast it.

Only that strdup() isn't a portable function.

Without more code to look at, I can only guess. But my guess is that he didn't include the right header for strdup and casted the result to silence his compiler's warnings about it.

thanks very much for the answers.