Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Penix's Pointer Tutorial Vol 2003
- #coders@efnet Mon Nov 10 00:13:11 2003...enjoy! (NSFW!)
- Logfile dug up from harddisk abyss and cleaned for pastebin use by equex 2010
- 1. Introduction.
- <domo> can anyone helr me with my pig latin program in C?
- <fIyback> why are you writing it in cobol?
- <domo> ya
- <domo> i wrote part of a pig lating program
- <domo> and i got stuck
- <domo> can u help me out with it?
- <domo> i'm not familiar with pointers
- <domo> and i have to continue writing using pointers
- <domo> i donno what to do
- <penix_> comrade are you on the bots? I want to use my lyme shell in here again.
- <penix_> cool, thanks
- <penix_> domo: Are you using C?
- <vman_____> PENIX
- <domo> ya
- <penix_> sup hoe?
- <vman_____> WTF HAPPEND TO URE OTHER NICK? :/
- <penix_> which one?
- <domo> penix i am using C
- <penix_> omgwtfbbq?
- <vman_____> |PENIX|
- <penix_> oh, over_load has it
- <penix_> So I have a bot waiting to jump on his
- <penix_> He's a loser, so he'll blow a gasket
- <penix_> flyback style
- <sleeve> can anyone suggest a storage structure for a clone of the dots game? (where players take turn connecting dots on a grid to make a box, most boxes win)
- <domo> PIG LATIN
- <sleeve> i tried using an 2d array of booleans, but it isnt very efficient
- <penix_> domo: Ok, so a pointer is like... an arrow kinda
- <domo> ya?
- <penix_> domo: It points to things.
- <penix_> Ya.
- <penix_> That's basicly it.
- <domo> so i fi send u my code u can't help me out with it?
- <penix_> Uh, no.
- <sleeve> a pointer is just an address. leave it at that
- <sleeve> now back to my dots fiasco :)
- <domo> ok
- 2. Pointer Basics I.
- <penix_> Ok, lets say I create a "char cock[256];". Now I got an array of 256 chars in cock.
- <penix_> cock itself is a pointer
- <vman_____> PENIX'S GIMP STATION
- <sleeve> yeah
- <penix_> it's pointing to the first char in that block of 256
- <sleeve> and so if you have a function and you want to return the array of cocks, the best way to do it is return the address of hte first cock, because you know the rest of hte cocks are sizeof(char) offset
- <sleeve> you know that (cock+sizeof(char)) = second element of cock, cock[1]
- <penix_> now lets create a pointer "char *ass;"
- <sleeve> because memory is sequential like that
- <sleeve> lol penix
- <penix_> Now you got this pointer called ass, and you got to point your ass at something
- <penix_> I know, lets point the ass at the cock
- <domo> no th cock at the ass
- <domo> :P
- * sleeve can tell this is a very helpful channel :)
- <penix_> "ass = cock;"
- <penix_> We can do ass = cock because cock is also a pointer
- <penix_> cock is really just number to a memory address
- <penix_> So now the contents of cock are in the ass
- <penix_> To play with things in the ass, you do the same thing you would to the cock
- <penix_> ass[0], ass[1], etc
- <mapp> lol penix
- <mapp> nice pimp station:P
- <penix_> I need to make an updated picture.
- <penix_> Oh wait, I got the cam here today.
- <penix_> I got CDs and all over the place. It's not as pretty as it was in that pic.
- 3. Pointer Basics II.
- <penix_> Ok, continuing on with pointers
- <penix_> Lets create a new variable "char tongue;"
- <penix_> tongue is not a pointer, it's just a normal variable.
- <penix_> We can just reuse ass since it was the correct pointer type for this example. "char *ass;"
- <penix_> Let's point ass at tongue. "ass = tongue;"
- <penix_> Oh wait, that's totally wrong!
- <penix_> Yes, C is fucking insane too!
- <penix_> Now ass is pointed to a memory address of whatever value was in tongue.
- <penix_> We have no idea what's in the ass now.
- <mapp> lol
- <penix_> The correct statement would be like "ass = &tongue;"
- <penix_> That points the ass to where the tongue is. & means return the address of something, not the value.
- <penix_> Now tongue is in ass, just like cock was in the ass earlier.
- <penix_> We know that ass is set to the address of tongue. If you want to change or read the value of what is at the address of tongue, you can do it 2 ways. (Actually, probably more, but 2 for this example.)
- <penix_> You can use ass[0], which points to the first, and only, value. This works just like when cock was in the ass.
- <penix_> Don't try and read ass[1] though. There aren't any restrictions during compilation that strictly forbid this, but you don't know what is in the ass at that address.
- <penix_> You can do ass[123123] if you want, but you don't know what that is. We only know what ass[0] is (tongue).
- <penix_> You try to read or write crazy shit and your shit just crashes.
- <penix_> The other way you can do things to what's in the ass is like "*ass = 32;"
- <penix_> The *ass means do stuff with what is at the address that ass holds. Right now the address of tongue is in the ass.
- <penix_> So "*ass = 32;" is changing tongue since tongue is in the ass right now.
- <bofhelix> i love it when people have down to earth explainations
- <penix_> The best way to learn this stuff is to just take your cock and tongue and play around with ass.
- <knightrd> fucking sicko
- <knightrd> oyster eating
- <knightrd> crazymofo
- <penix_> Man, all this programming talk got me hard.
- <goog|e> :|
- <penix_> domo, you get all this?
- <goog|e> what happens if its 64-bit ?
- <penix_> Basicly the same. They're all pink on the inside.
- <goog|e> rofl
- <penix_> Maybe I should put this tutorial on my website.
- <vman_____> what tutorial? how to suck 99 niggercocks at once?
- 4. Intermediate Pointer Arithmetics.
- <penix_> Wait, one more section a forgot. Pointer arithmatic.
- <penix_> For this example we are going to use "char cock[5];" and "char *ass;"
- <penix_> Now I'm going to load a string into cock
- <penix_> "strcpy(cock, "jizz");"
- <penix_> cock is now full of jizz and ready to go
- <penix_> But wait, jizz is 4 letters and cock is 5 long. Cock isn't full! If you came to this conclusion, you are stupid.
- <penix_> jizz is 4 letters but it must have a null character at the end to terminate it.
- <penix_> so cock is set to "jizz\0".
- <penix_> Let's get the ass and the cock together again. "ass = cock;"/
- <ferrex> hahaha
- <penix_> Now let's see what's in the ass.
- <penix_> ass[0] == 'j';
- <penix_> ass[1] == 'i';
- <penix_> ass[2] == 'z';
- <ferrex> memcpy(penixbrain, null);
- <penix_> ass[3] == 'z';
- <penix_> ass[4] == 0;
- <penix_> I know, that's just to say
- <penix_> I'm not setting it fool, we are looking at what's in the ass.
- <penix_> As you can see, "jizz" is in the ass.
- <penix_> The jizz came from cock
- <imh> this professor is full of shit
- <imh> and jizz
- <bofhelix> HAHAHA
- <penix_> "shit" is not in the ass right now, "jizz" is in the ass right now.
- <vman_____> "jizz" is in YOUR ass right now
- <penix_> "strcpy(ass, "shit");" would put shit in the ass
- <vman_____> cause u've been raped by 20 fat smelly farmhand niggers
- <penix_> Let's do some pointer arithmatic now. "ass++;" increments what's in ass right now.
- <penix_> ass is a memory address, so we just added 1 to it.
- <penix_> Let's look at what's in the ass now.
- <penix_> ass[0] == 'i'
- <penix_> ass[1] == 'z'
- <penix_> ass[2] == 'z'
- <penix_> ass[3] == 0
- <penix_> ass[4] == ?????
- <imh> can we learn about ass methods and properties? can we make ass an object, like women are
- <penix_> We don't know what is in the ass at 4, so don't try to take or put anything in that place of the ass
- <imh> women.fuck(ass,cawk);
- <penix_> Remember, ass is a pointer and doesn't keep track of where you put things. You point your ass at the wrong thing and you don't know what will end up in your ass.
- <imh> oh ok
- <imh> sorry, im not doing well in your class
- <fIyback> hi penix
- <penix_> who the hell are you?
- <fIyback> you know
- <imh> im going to start a C tutorial site using sex as a programming example
- <fIyback> your old pal flyback
- <fIyback> have any new gay porn?
- <domo> ewww
- <fIyback> remember the time you showed me your collection? it was the biggest ive ever seen
- <domo> :)
- <imh> gay porn? wtf
- <imh> gross
- <penix_> Porn? Why look at porn when you can get the real thing for free?
- <imh> so flyback doesnt have a bitch underneath his desk like we do penix?
- <fIyback> penix is pathetic
- <penix_> He has a male bitch under his desk.
- <imh> oh
- <imh> what a freak
- <penix_> Anyway, gotta finish the tutorial.
- <imh> ok later penix
- <penix_> later
- <penix_> So let's do like "ass--;".
- <imh> oh cool, y ou're not leaving :)
- <penix_> Yeah, I gotta finish this chat tutorial for domo
- <imh> ok
- <penix_> Now the address of ass is lowered by 1. Let's look at what's in the ass now
- <penix_> ass[0] == 'j' ass[1] == 'i' ass[2] == 'z' ass[3] == 'z' ass[4] == 0
- <fIyback> flyback is in the ass
- <fIyback> what a nice ass you have penix
- <imh> dude shut up the prof is talking
- <penix_> "jizz" is in the ass once again.
- <fIyback> you fag
- <fIyback> why are you gay?
- 5. Advanced Pointer Arithmetics.
- <penix_> Let's do a slightly more complex example. Starting over "char *ass;
- <penix_> "
- <penix_> "char cock[10]";
- <penix_> Now we got a large cock, twice the size of the last cock, but the same ass.
- <fIyback> penix: why does everything say have to do with males?
- <fIyback> you are a fag
- <fIyback> penix is gay for real
- <ferrex> how about we address multi dimensional arrays now
- <ferrex> in my current favorite: php
- <domo> LOL
- <penix_> Shut up, I'm trying to teach someone about c pointers.
- <ferrex> its as easy as this: $faggots = array();
- <ferrex> you then put in penix
- <fIyback> why cant you use real examples and not promotions of homosexuality
- <ferrex> $faggots['penix'] = array();
- <ferrex> and now you can give penix various attributes by using the multi dimensionality
- <ferrex> $faggots['penix']['penis_size'] = 0;
- <ferrex> $faggots['penix']['IQ'] = 11;
- <penix_> Ok, so let's put something in our cock array. "strcpy(cock, "shit jizz");".
- <ferrex> $faggots['flyback']['penis_size'] = -2.4;
- <ferrex> $faggots['flyback']['IQ'] = 1;
- <ferrex> if you want to display all the $faggots now, all you have to do is
- <penix_> ewww, he has an imploding penis.
- <ferrex> while( list($ke) = each($faggots) ) {
- <antilice> I actually thought his tongue in ass pointer lesson was fairly clever. Surely his IQ is higher than 11
- <bofhelix> yeah
- <bofhelix> im logging this shit
- <bofhelix> lol
- <ferrex> echo "penis size of $ke:".$faggots[$ke]['penis_size'];
- <ferrex> }
- <ferrex> isnt that cool?
- <vman_____> what? u fucking dead niggers in the ass...
- <vman_____> thats not cool
- <vman_____> thats just NASTY
- <penix_> Ok, so now we got "shit jizz\0" in cock
- <fdsks> gayz
- <ferrex> you shut the hell up vman_____
- <domo> CAN ANYONe help me out in a pig latin program?
- <ferrex> $faggots['vman']['skin_color'] = BLACK;
- <ferrex> there you go
- <vman_____> :(
- <goog|e> rofl
- <vman_____> i was just trying to be nice :(
- * linker sets mode: +o disturb`
- <penix_> Let's point the ass at something, more specificly, the cock.
- <ferrex> dont forget a define('BLACK', '#000000'); though
- <penix_> "ass = cock;". Now let's do something more advanced. Let's split the cock in 2.
- <disturb`> ouch!
- <imh> penix!
- <imh> stop this tutorial!
- <penix_> We are going to replace the " " in "shit jizz\0" with '\0'. This will create 2 strings.
- <goog|e> lmao
- <penix_> Don't worry, this tutorial has a happy ending.
- <ferrex> it wont
- <ferrex> you dumbass
- <ferrex> it will just terminate the string after shit
- <ferrex> and its still one string
- * imh shakes his head
- <penix_> C doesn't have native strings, dumbass
- <penix_> I'm just saying
- <ferrex> and speaking in php '\0' is wrong, as '' wont evaluate control characters, variables and so on
- <ferrex> in C this doesnt have any meaning anyway
- <goog|e> you know ferrex
- <goog|e> just cause you dont understand this
- <goog|e> doesnt mean you have to go ruin for the rest of us
- <penix_> wtf are you talking about '\0' is the same as 0
- <penix_> crazy fooo
- <ferrex> i said in php '\0' is \0, and "\0" is 0
- <goog|e> just slap him around
- <imh> who the fuck is talking about php
- <ferrex> dumb bastard
- <penix_> shut up fool, this is C, not php
- <ferrex> i was throwing that in, as he was using "" and '' like a mofo
- <penix_> Ok, so we do like this: "ass[4] = '\0';" or better yet "ass[4] = 0;".
- <ferrex> and \0 will still just terminate the string you idiot
- <ferrex> go print it, it'll print "shit"
- <penix_> You slut, I'm not done with my tutorial
- <imh> dude, ferrex is that dumb asian chick who sits at the front of the class and gets the professor off subject with stupid questions
- <penix_> shut up
- <goog|e> rofl
- <ferrex> im not asian and not a chick
- <goog|e> imh - is she pretty :P ?
- <ferrex> im a huge mean german
- <imh> no she's dog ugly
- <ferrex> who will burn you alive if you dont stfu
- <goog|e> :oh :(
- <goog|e> i'm beginning not to like this tutorial
- <imh> it was good till the stupid asian chick fucked it up
- <ferrex> how about assembler instead
- <ferrex> mv kz, google
- <imh> asking questions about php and shit
- <ferrex> mov even
- <ferrex> damnit
- <antilice> Yeah, with all the interruptions this is really starting to suck
- <goog|e> excuse me teacher
- <penix_> ok, now we are going to print what is in ass. "printf("%s\n", ass);".
- <penix_> This will print out "shit".
- <goog|e> but i feel like my privilege to learn is being
- <goog|e> ooooooooo
- <goog|e> opressed here
- <penix_> yes, ferrex is very disruptive.
- <penix_> Someone put something long and hard in his mouth to shut him up.
- <ferrex> come and beat me with a stick then
- <ferrex> i shall beat you back with my arsenal of nuclear weaponry
- <penix_> So right now we got shit in the ass. Let's do like "ass = cock[5];"
- <ferrex> oh and by the way
- <penix_> Now let's see what's in the ass
- <ferrex> "printf("%s\n", ass);". will not print "shit"
- <ferrex> it will print "shit
- <ferrex> "
- <penix_> Oh yeah, good catch. I put a new line at the end.
- <penix_> So do like "printf("%s", ass);" and now we print "jizz";
- <penix_> Now jizz is in the ass again
- <antilice> Wow, jizz is in the ass again? That's slick
- <ferrex> why dont you tell us about sockets, and how we can penetrate 'ass.hole.org' with packets that contain 'sperm'
- <imh> you're in the wrong class
- <imh> shut up asian chick
- <penix_> right now we're just talking pointers, not sockets
- <ferrex> no im right, and pretty sure
- <ferrex> isnt this "irc perversion for beginners"?
- <imh> no its C pointers miss sucky sucky
- <fIyback> penis is gay
- <fIyback> ban him
- <fIyback> he is the fake flyback too
- <fIyback> which proves his gayness
- <ferrex> i call that sexual offense imh
- * imh is sorry :(
- * imh begs ferrex not to tell the dean
- <penix_> wait a sec... i think i had an error up there that no one caught
- <ferrex> seing even the teacher doesnt do anything i will just quit the class
- <penix_> "ass = cock[5];" is wrong, it should have been "ass = &cock[5];"
- <penix_> cock[5] == 'j', not an address
- <penix_> ass points to an address, so we need to do like &cock[5]
- <penix_> Let's do like "ass--;" which sets ass to cock[4]
- <penix_> cock[4] == 0, the null string terminator
- <penix_> if we try to print ass now, "printf("%s", ass);", we get "".
- <ScratXP> this is still goin gon?
- <ScratXP> huhu
- <penix_> Nothing, because the first character ass[0] is set to the null terminator.
- <ScratXP> the first character is arnold swartaznegger?
- <penix_> Let's over write that with " ", "ass[0] = ' ';"
- <ferrex> i think penix_ lost the point
- <penix_> Now we are back to what we started with. Let's point the ass back at cock: "ass = cock;"
- <penix_> And print it out: "printf("%s", ass);", which prints "shit jizz".
- <xyclone> wtf
- <penix_> As you can see, we are back to having shit and jizz in the ass.
- <penix_> And that concludes my pointer examples.
- <penix_> Again, the best way to learn this stuff is just to take your ass and cock and play with them.
- <mapp> lol
- <goog|e> and that concludes sex education for today
- * domo (~a@63.172.9.25) Quit
- <penix_> wtf, stupid domo
- <vman_____> i think u mean homo :(
Add Comment
Please, Sign In to add comment