Timeline for Error: incompatible integer to pointer conversion initializing 'int *' with an expression of type 'int'; take the address with &
Current License: CC BY-SA 3.0
4 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
May 23, 2023 at 3:18 | comment | added | Cliff B |
This is a new reply to an old comment that I missed. Keep in mind that I have not seen (or don't remember seeing) the specific video. Having said that, Prof. Malan was clearly discussing the speller problem set and linked lists. It's almost certain that list is also declared as a pointer to a node structure. It is perfectly correct to copy the address stored in one pointer var to another pointer var using something like a = b; when both a and b are declared as pointers to the same data types or the same struct types.
|
|
Jun 25, 2017 at 16:09 | comment | added | Haim | Thanks Cliff. From your code, I understand that a pointer (*pointer) should point to an address (&p). However, in the lecture of week 5, David writes code for a node as: node *ptr = list. Why does this work? Shouldn't *ptr be assigned to a value like &list? | |
Jun 22, 2017 at 2:37 | vote | accept | Haim | ||
Jun 21, 2017 at 1:07 | history | answered | Cliff B | CC BY-SA 3.0 |