0

hello,
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?

4
Contributors
4
Replies
5
Views
8 Years
Discussion Span
Last Post by xyzt
0

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.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.