Stop Microsoft

Miscellaneous => Programming & Networking => Topic started by: Bazoukas on 19 November 2002, 08:44

Title: Why does it give me the addy location?
Post by: Bazoukas 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.
Title: Why does it give me the addy location?
Post by: Bazoukas on 19 November 2002, 08:57
its official. i am TUPID.


cout<<str[0];
Title: Why does it give me the addy location?
Post by: voidmain on 19 November 2002, 08:58
Or this:

Code: [Select]

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

Title: Why does it give me the addy location?
Post by: Bazoukas 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.
Title: Why does it give me the addy location?
Post by: voidmain 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 ]

Title: Why does it give me the addy location?
Post by: Bazoukas 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
Title: Why does it give me the addy location?
Post by: voidmain on 19 November 2002, 21:30
You mean something like this?

Code: [Select]

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

Title: Why does it give me the addy location?
Post by: Bazoukas 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
Title: Why does it give me the addy location?
Post by: voidmain on 19 November 2002, 21:35
Yeah, pointers can be a bitch to learn. Don't ask me to teach you.  (http://smile.gif)
Title: Why does it give me the addy location?
Post by: Bazoukas on 19 November 2002, 21:38
THats it then. No lesbian stripers for your birthday.  (http://tongue.gif)

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

Title: Why does it give me the addy location?
Post by: Kintaro on 20 November 2002, 10:23
Im going to learn these properly one day... now i know not to ask MainVoid
Title: Why does it give me the addy location?
Post by: Bazoukas 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. (http://geocities.com/ellhnas25)


 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 ]