Author Topic: Why does it give me the addy location?  (Read 1166 times)

Bazoukas

  • Member
  • **
  • Posts: 866
  • Kudos: 140
    • http://whitehouse.com
Why does it give me the addy location?
« on: 19 November 2002, 08:44 »
int main() {
   int val;
   int str[1]={1};
   int *p1;

   p1=str;
   cout<<str;//tried with p1 same thing
   return 0;
   
}

0xbffff9f0 this is what i get. I thought it takes the 1st value of the array. Me is confused.
Yeah

Bazoukas

  • Member
  • **
  • Posts: 866
  • Kudos: 140
    • http://whitehouse.com
Why does it give me the addy location?
« Reply #1 on: 19 November 2002, 08:57 »
its official. i am TUPID.


cout<<str[0];
Yeah

voidmain

  • VIP
  • Member
  • ***
  • Posts: 5,605
  • Kudos: 184
    • http://voidmain.is-a-geek.net/
Why does it give me the addy location?
« Reply #2 on: 19 November 2002, 08:58 »
Or this:

Code: [Select]

[ November 19, 2002: Message edited by: void main ]

Someone please remove this account. Thanks...

Bazoukas

  • Member
  • **
  • Posts: 866
  • Kudos: 140
    • http://whitehouse.com
Why does it give me the addy location?
« Reply #3 on: 19 November 2002, 21:02 »
hmm you way seems to be more sufficient in a large array. I will toy around with it now that I saw what i was missing.

 Its kinda confusing till you get the hang of it.
Yeah

voidmain

  • VIP
  • Member
  • ***
  • Posts: 5,605
  • Kudos: 184
    • http://voidmain.is-a-geek.net/
Why does it give me the addy location?
« Reply #4 on: 19 November 2002, 21:20 »
I'm not sure what you are doing but what I posted as an example is not something I personally would do (I don't believe anyway without knowing what you are working on). I just put it in the syntax that would work like I thought *you* wanted it to.

[ November 19, 2002: Message edited by: void main ]

Someone please remove this account. Thanks...

Bazoukas

  • Member
  • **
  • Posts: 866
  • Kudos: 140
    • http://whitehouse.com
Why does it give me the addy location?
« Reply #5 on: 19 November 2002, 21:24 »
oh yeah sorry bout that.

 I was trying to display the element of the array which in my case is one. I am trying to get the hang of arrays and pointers.

 From the little i played around with, i can tell you can do some nifty things.With ++ -- operators. Am guessing it saves you from alot of for loops.

 Am still trying to figure out what it can do.
Cool stuff  :D
Yeah

voidmain

  • VIP
  • Member
  • ***
  • Posts: 5,605
  • Kudos: 184
    • http://voidmain.is-a-geek.net/
Why does it give me the addy location?
« Reply #6 on: 19 November 2002, 21:30 »
You mean something like this?

Code: [Select]

[ November 19, 2002: Message edited by: void main ]

Someone please remove this account. Thanks...

Bazoukas

  • Member
  • **
  • Posts: 866
  • Kudos: 140
    • http://whitehouse.com
Why does it give me the addy location?
« Reply #7 on: 19 November 2002, 21:33 »
yep. but there things here in the books that just make my head spin. delete - indexing- multiple inderections.....this is the 1st time am doing pointers seriously (cause of school) and my head spins right now. Too much info to go around my small head   :eek:  
 But I can tell i will love pointers. They seem to be much flexible
Yeah

voidmain

  • VIP
  • Member
  • ***
  • Posts: 5,605
  • Kudos: 184
    • http://voidmain.is-a-geek.net/
Why does it give me the addy location?
« Reply #8 on: 19 November 2002, 21:35 »
Yeah, pointers can be a bitch to learn. Don't ask me to teach you.  
Someone please remove this account. Thanks...

Bazoukas

  • Member
  • **
  • Posts: 866
  • Kudos: 140
    • http://whitehouse.com
Why does it give me the addy location?
« Reply #9 on: 19 November 2002, 21:38 »
THats it then. No lesbian stripers for your birthday.  

[ November 19, 2002: Message edited by: bazoukas ]

Yeah

Kintaro

  • Member
  • **
  • Posts: 6,545
  • Kudos: 255
  • I want to get the band back together!
    • JohnTate.org
Why does it give me the addy location?
« Reply #10 on: 20 November 2002, 10:23 »
Im going to learn these properly one day... now i know not to ask MainVoid

Bazoukas

  • Member
  • **
  • Posts: 866
  • Kudos: 140
    • http://whitehouse.com
Why does it give me the addy location?
« Reply #11 on: 20 November 2002, 20:35 »
Its not that hard, and its not that easy either. You just have to approach it with confidence and humility and take it step by step.
  In two and a half weeks we will be on vacations so I will publish in my web site that freaking tutorial that i wanted to do for so long.

 Here is a half ass job that I did like a year ago when I was doing C++ on my own free time.
 Yes i know its made with frontpage. I was an MS ho then so forgive.
 
  I covered from intro all the way to selection structures. You can learn these in matter of few days if not less than that.


 The link on the bottom of the home page leads you to a stupid forum that I used to visit. Actually it was the very 1st forum I posted in. It filled with a bunch of fucking cry babies. So dont bother.

[ November 20, 2002: Message edited by: bazoukas ]

[ November 20, 2002: Message edited by: bazoukas ]

Yeah