LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   linked list node parsing (https://www.linuxquestions.org/questions/programming-9/linked-list-node-parsing-4175487620/)

atlantis43 12-11-2013 11:48 AM

linked list node parsing
 
Wonder if anyone can explain the difference between the following two expressions to allocate a node. Both expressions work perfectly well in my code, but I don't understand the reasoning for the second version.
Code:

node *temp = malloc(sizeof(node));
    node *temp = (node *) malloc(sizeof(node));


ntubski 12-11-2013 03:27 PM

C FAQ 7.7.

If you want to also compile the code as C++ you need the cast.


All times are GMT -5. The time now is 09:42 AM.