Quick question on section "Getting the data at an address"


#1

This should probably be horribly obvious to me but…

In this section towards the bottom of the section it is written:

"Now let’s make a common programming mistake. Remove the * from the fourth line of main() so that it reads

addresOfI = 89;

Notice Xcode pops up a warning that says Incompatible integer to pointer conversion assigning to ‘int *’ to ‘int’. Fix the problem."

The only “fix” for the problem I can think of is putting the * back in front of addressOfI. Is this what was intended for me to figure out?

Like I said, I just know that someones gonna pop in here with an answer that is gonna make me slap myself on the forehead so hard there will be a mark left for a week, but, please help!

This chapter seems to be causing great confusion for me.


#2

Yes, I think the best fix is to put the * back in.


#3

This reminds me of something: I have noticed the error when I was reading the book but I forgot all about it.

to ‘int *’[color=#FF0000] to [/color] ‘int’ should be ‘to int *’[color=#FF0000] from [/color] ‘int’.


#4

Thank you. I thought so but my mind just kept saying “No… that can’t be it, you just not being smart enough.”


#5

[quote=“ibex10”][quote]
Notice Xcode pops up a warning that says Incompatible integer to pointer conversion assigning to ‘int *’[color=#FF0000] to [/color] ‘int’. Fix the problem."
[/quote]
This reminds me of something: I have noticed the error when I was reading the book but I forgot all about it.

to ‘int *’[color=#FF0000] to [/color] ‘int’ should be ‘to int *’[color=#FF0000] from [/color] ‘int’.[/quote]

Yeah, I felt like that should be different. From makes a lot more since.


#6

Haha. My brain was rattling trying to figure this out. Thanks.