Guest User

Penix Pointer Tutorial Vol 2003

a guest
Sep 27th, 2010
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 15.60 KB | None | 0 0
  1. Penix's Pointer Tutorial Vol 2003
  2. #coders@efnet Mon Nov 10 00:13:11 2003...enjoy! (NSFW!)
  3. Logfile dug up from harddisk abyss and cleaned for pastebin use by equex 2010
  5. 1. Introduction.
  7. <domo> can anyone helr me with my pig latin program in C?
  8. <fIyback> why are you writing it in cobol?
  9. <domo> ya
  10. <domo> i wrote part of a pig lating program
  11. <domo> and i got stuck
  12. <domo> can u help me out with it?
  13. <domo> i'm not familiar with pointers
  14. <domo> and i have to continue writing using pointers
  15. <domo> i donno what to do
  16. <penix_> comrade are you on the bots? I want to use my lyme shell in here again.
  17. <penix_> cool, thanks
  18. <penix_> domo: Are you using C?
  19. <vman_____> PENIX
  20. <domo> ya
  21. <penix_> sup hoe?
  22. <vman_____> WTF HAPPEND TO URE OTHER NICK? :/
  23. <penix_> which one?
  24. <domo> penix i am using C
  25. <penix_> omgwtfbbq?
  26. <vman_____> |PENIX|
  27. <penix_> oh, over_load has it
  28. <penix_> So I have a bot waiting to jump on his
  29. <penix_> He's a loser, so he'll blow a gasket
  30. <penix_> flyback style
  31. <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)
  32. <domo> PIG LATIN
  33. <sleeve> i tried using an 2d array of booleans, but it isnt very efficient
  34. <penix_> domo: Ok, so a pointer is like... an arrow kinda
  35. <domo> ya?
  36. <penix_> domo: It points to things.
  37. <penix_> Ya.
  38. <penix_> That's basicly it.
  39. <domo> so i fi send u my code u can't help me out with it?
  40. <penix_> Uh, no.
  41. <sleeve> a pointer is just an address. leave it at that
  42. <sleeve> now back to my dots fiasco :)
  43. <domo> ok
  45. 2. Pointer Basics I.
  47. <penix_> Ok, lets say I create a "char cock[256];". Now I got an array of 256 chars in cock.
  48. <penix_> cock itself is a pointer
  49. <vman_____> PENIX'S GIMP STATION
  50. <sleeve> yeah
  51. <penix_> it's pointing to the first char in that block of 256
  52. <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
  53. <sleeve> you know that (cock+sizeof(char)) = second element of cock, cock[1]
  54. <penix_> now lets create a pointer "char *ass;"
  55. <sleeve> because memory is sequential like that
  56. <sleeve> lol penix
  57. <penix_> Now you got this pointer called ass, and you got to point your ass at something
  58. <penix_> I know, lets point the ass at the cock
  59. <domo> no th cock at the ass
  60. <domo> :P
  61. * sleeve can tell this is a very helpful channel :)
  62. <penix_> "ass = cock;"
  63. <penix_> We can do ass = cock because cock is also a pointer
  64. <penix_> cock is really just number to a memory address
  65. <penix_> So now the contents of cock are in the ass
  66. <penix_> To play with things in the ass, you do the same thing you would to the cock
  67. <penix_> ass[0], ass[1], etc
  68. <mapp> lol penix
  69. <mapp> nice pimp station:P
  70. <penix_> I need to make an updated picture.
  71. <penix_> Oh wait, I got the cam here today.
  72. <penix_> I got CDs and all over the place. It's not as pretty as it was in that pic.
  74. 3. Pointer Basics II.
  76. <penix_> Ok, continuing on with pointers
  77. <penix_> Lets create a new variable "char tongue;"
  78. <penix_> tongue is not a pointer, it's just a normal variable.
  79. <penix_> We can just reuse ass since it was the correct pointer type for this example. "char *ass;"
  80. <penix_> Let's point ass at tongue. "ass = tongue;"
  81. <penix_> Oh wait, that's totally wrong!
  82. <penix_> Yes, C is fucking insane too!
  83. <penix_> Now ass is pointed to a memory address of whatever value was in tongue.
  84. <penix_> We have no idea what's in the ass now.
  85. <mapp> lol
  86. <penix_> The correct statement would be like "ass = &tongue;"
  87. <penix_> That points the ass to where the tongue is. & means return the address of something, not the value.
  88. <penix_> Now tongue is in ass, just like cock was in the ass earlier.
  89. <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.)
  90. <penix_> You can use ass[0], which points to the first, and only, value. This works just like when cock was in the ass.
  91. <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.
  92. <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).
  93. <penix_> You try to read or write crazy shit and your shit just crashes.
  94. <penix_> The other way you can do things to what's in the ass is like "*ass = 32;"
  95. <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.
  96. <penix_> So "*ass = 32;" is changing tongue since tongue is in the ass right now.
  97. <bofhelix> i love it when people have down to earth explainations
  98. <penix_> The best way to learn this stuff is to just take your cock and tongue and play around with ass.
  99. <knightrd> fucking sicko
  100. <knightrd> oyster eating
  101. <knightrd> crazymofo
  102. <penix_> Man, all this programming talk got me hard.
  103. <goog|e> :|
  104. <penix_> domo, you get all this?
  105. <goog|e> what happens if its 64-bit ?
  106. <penix_> Basicly the same. They're all pink on the inside.
  107. <goog|e> rofl
  108. <penix_> Maybe I should put this tutorial on my website.
  109. <vman_____> what tutorial? how to suck 99 niggercocks at once?
  111. 4. Intermediate Pointer Arithmetics.
  113. <penix_> Wait, one more section a forgot. Pointer arithmatic.
  114. <penix_> For this example we are going to use "char cock[5];" and "char *ass;"
  115. <penix_> Now I'm going to load a string into cock
  116. <penix_> "strcpy(cock, "jizz");"
  117. <penix_> cock is now full of jizz and ready to go
  118. <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.
  119. <penix_> jizz is 4 letters but it must have a null character at the end to terminate it.
  120. <penix_> so cock is set to "jizz\0".
  121. <penix_> Let's get the ass and the cock together again. "ass = cock;"/
  122. <ferrex> hahaha
  123. <penix_> Now let's see what's in the ass.
  124. <penix_> ass[0] == 'j';
  125. <penix_> ass[1] == 'i';
  126. <penix_> ass[2] == 'z';
  127. <ferrex> memcpy(penixbrain, null);
  128. <penix_> ass[3] == 'z';
  129. <penix_> ass[4] == 0;
  130. <penix_> I know, that's just to say
  131. <penix_> I'm not setting it fool, we are looking at what's in the ass.
  132. <penix_> As you can see, "jizz" is in the ass.
  133. <penix_> The jizz came from cock
  134. <imh> this professor is full of shit
  135. <imh> and jizz
  136. <bofhelix> HAHAHA
  137. <penix_> "shit" is not in the ass right now, "jizz" is in the ass right now.
  138. <vman_____> "jizz" is in YOUR ass right now
  139. <penix_> "strcpy(ass, "shit");" would put shit in the ass
  140. <vman_____> cause u've been raped by 20 fat smelly farmhand niggers
  141. <penix_> Let's do some pointer arithmatic now. "ass++;" increments what's in ass right now.
  142. <penix_> ass is a memory address, so we just added 1 to it.
  143. <penix_> Let's look at what's in the ass now.
  144. <penix_> ass[0] == 'i'
  145. <penix_> ass[1] == 'z'
  146. <penix_> ass[2] == 'z'
  147. <penix_> ass[3] == 0
  148. <penix_> ass[4] == ?????
  149. <imh> can we learn about ass methods and properties? can we make ass an object, like women are
  150. <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
  151. <imh> women.fuck(ass,cawk);
  152. <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.
  153. <imh> oh ok
  154. <imh> sorry, im not doing well in your class
  155. <fIyback> hi penix
  156. <penix_> who the hell are you?
  157. <fIyback> you know
  158. <imh> im going to start a C tutorial site using sex as a programming example
  159. <fIyback> your old pal flyback
  160. <fIyback> have any new gay porn?
  161. <domo> ewww
  162. <fIyback> remember the time you showed me your collection? it was the biggest ive ever seen
  163. <domo> :)
  164. <imh> gay porn? wtf
  165. <imh> gross
  166. <penix_> Porn? Why look at porn when you can get the real thing for free?
  167. <imh> so flyback doesnt have a bitch underneath his desk like we do penix?
  168. <fIyback> penix is pathetic
  169. <penix_> He has a male bitch under his desk.
  170. <imh> oh
  171. <imh> what a freak
  172. <penix_> Anyway, gotta finish the tutorial.
  173. <imh> ok later penix
  174. <penix_> later
  175. <penix_> So let's do like "ass--;".
  176. <imh> oh cool, y ou're not leaving :)
  177. <penix_> Yeah, I gotta finish this chat tutorial for domo
  178. <imh> ok
  179. <penix_> Now the address of ass is lowered by 1. Let's look at what's in the ass now
  180. <penix_> ass[0] == 'j' ass[1] == 'i' ass[2] == 'z' ass[3] == 'z' ass[4] == 0
  181. <fIyback> flyback is in the ass
  182. <fIyback> what a nice ass you have penix
  183. <imh> dude shut up the prof is talking
  184. <penix_> "jizz" is in the ass once again.
  185. <fIyback> you fag
  186. <fIyback> why are you gay?
  188. 5. Advanced Pointer Arithmetics.
  190. <penix_> Let's do a slightly more complex example. Starting over "char *ass;
  191. <penix_> "
  192. <penix_> "char cock[10]";
  193. <penix_> Now we got a large cock, twice the size of the last cock, but the same ass.
  194. <fIyback> penix: why does everything say have to do with males?
  195. <fIyback> you are a fag
  196. <fIyback> penix is gay for real
  197. <ferrex> how about we address multi dimensional arrays now
  198. <ferrex> in my current favorite: php
  199. <domo> LOL
  200. <penix_> Shut up, I'm trying to teach someone about c pointers.
  201. <ferrex> its as easy as this: $faggots = array();
  202. <ferrex> you then put in penix
  203. <fIyback> why cant you use real examples and not promotions of homosexuality
  204. <ferrex> $faggots['penix'] = array();
  205. <ferrex> and now you can give penix various attributes by using the multi dimensionality
  206. <ferrex> $faggots['penix']['penis_size'] = 0;
  207. <ferrex> $faggots['penix']['IQ'] = 11;
  208. <penix_> Ok, so let's put something in our cock array. "strcpy(cock, "shit jizz");".
  209. <ferrex> $faggots['flyback']['penis_size'] = -2.4;
  210. <ferrex> $faggots['flyback']['IQ'] = 1;
  211. <ferrex> if you want to display all the $faggots now, all you have to do is
  212. <penix_> ewww, he has an imploding penis.
  213. <ferrex> while( list($ke) = each($faggots) ) {
  214. <antilice> I actually thought his tongue in ass pointer lesson was fairly clever. Surely his IQ is higher than 11
  215. <bofhelix> yeah
  216. <bofhelix> im logging this shit
  217. <bofhelix> lol
  218. <ferrex> echo "penis size of $ke:".$faggots[$ke]['penis_size'];
  219. <ferrex> }
  220. <ferrex> isnt that cool?
  221. <vman_____> what? u fucking dead niggers in the ass...
  222. <vman_____> thats not cool
  223. <vman_____> thats just NASTY
  224. <penix_> Ok, so now we got "shit jizz\0" in cock
  225. <fdsks> gayz
  226. <ferrex> you shut the hell up vman_____
  227. <domo> CAN ANYONe help me out in a pig latin program?
  228. <ferrex> $faggots['vman']['skin_color'] = BLACK;
  229. <ferrex> there you go
  230. <vman_____> :(
  231. <goog|e> rofl
  232. <vman_____> i was just trying to be nice :(
  233. * linker sets mode: +o disturb`
  234. <penix_> Let's point the ass at something, more specificly, the cock.
  235. <ferrex> dont forget a define('BLACK', '#000000'); though
  236. <penix_> "ass = cock;". Now let's do something more advanced. Let's split the cock in 2.
  237. <disturb`> ouch!
  238. <imh> penix!
  239. <imh> stop this tutorial!
  240. <penix_> We are going to replace the " " in "shit jizz\0" with '\0'. This will create 2 strings.
  241. <goog|e> lmao
  242. <penix_> Don't worry, this tutorial has a happy ending.
  243. <ferrex> it wont
  244. <ferrex> you dumbass
  245. <ferrex> it will just terminate the string after shit
  246. <ferrex> and its still one string
  247. * imh shakes his head
  248. <penix_> C doesn't have native strings, dumbass
  249. <penix_> I'm just saying
  250. <ferrex> and speaking in php '\0' is wrong, as '' wont evaluate control characters, variables and so on
  251. <ferrex> in C this doesnt have any meaning anyway
  252. <goog|e> you know ferrex
  253. <goog|e> just cause you dont understand this
  254. <goog|e> doesnt mean you have to go ruin for the rest of us
  255. <penix_> wtf are you talking about '\0' is the same as 0
  256. <penix_> crazy fooo
  257. <ferrex> i said in php '\0' is \0, and "\0" is 0
  258. <goog|e> just slap him around
  259. <imh> who the fuck is talking about php
  260. <ferrex> dumb bastard
  261. <penix_> shut up fool, this is C, not php
  262. <ferrex> i was throwing that in, as he was using "" and '' like a mofo
  263. <penix_> Ok, so we do like this: "ass[4] = '\0';" or better yet "ass[4] = 0;".
  264. <ferrex> and \0 will still just terminate the string you idiot
  265. <ferrex> go print it, it'll print "shit"
  266. <penix_> You slut, I'm not done with my tutorial
  267. <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
  268. <penix_> shut up
  269. <goog|e> rofl
  270. <ferrex> im not asian and not a chick
  271. <goog|e> imh - is she pretty :P ?
  272. <ferrex> im a huge mean german
  273. <imh> no she's dog ugly
  274. <ferrex> who will burn you alive if you dont stfu
  275. <goog|e> :oh :(
  276. <goog|e> i'm beginning not to like this tutorial
  277. <imh> it was good till the stupid asian chick fucked it up
  278. <ferrex> how about assembler instead
  279. <ferrex> mv kz, google
  280. <imh> asking questions about php and shit
  281. <ferrex> mov even
  282. <ferrex> damnit
  283. <antilice> Yeah, with all the interruptions this is really starting to suck
  284. <goog|e> excuse me teacher
  285. <penix_> ok, now we are going to print what is in ass. "printf("%s\n", ass);".
  286. <penix_> This will print out "shit".
  287. <goog|e> but i feel like my privilege to learn is being
  288. <goog|e> ooooooooo
  289. <goog|e> opressed here
  290. <penix_> yes, ferrex is very disruptive.
  291. <penix_> Someone put something long and hard in his mouth to shut him up.
  292. <ferrex> come and beat me with a stick then
  293. <ferrex> i shall beat you back with my arsenal of nuclear weaponry
  294. <penix_> So right now we got shit in the ass. Let's do like "ass = cock[5];"
  295. <ferrex> oh and by the way
  296. <penix_> Now let's see what's in the ass
  297. <ferrex> "printf("%s\n", ass);". will not print "shit"
  298. <ferrex> it will print "shit
  299. <ferrex> "
  300. <penix_> Oh yeah, good catch. I put a new line at the end.
  301. <penix_> So do like "printf("%s", ass);" and now we print "jizz";
  302. <penix_> Now jizz is in the ass again
  303. <antilice> Wow, jizz is in the ass again? That's slick
  304. <ferrex> why dont you tell us about sockets, and how we can penetrate '' with packets that contain 'sperm'
  305. <imh> you're in the wrong class
  306. <imh> shut up asian chick
  307. <penix_> right now we're just talking pointers, not sockets
  308. <ferrex> no im right, and pretty sure
  309. <ferrex> isnt this "irc perversion for beginners"?
  310. <imh> no its C pointers miss sucky sucky
  311. <fIyback> penis is gay
  312. <fIyback> ban him
  313. <fIyback> he is the fake flyback too
  314. <fIyback> which proves his gayness
  315. <ferrex> i call that sexual offense imh
  316. * imh is sorry :(
  317. * imh begs ferrex not to tell the dean
  318. <penix_> wait a sec... i think i had an error up there that no one caught
  319. <ferrex> seing even the teacher doesnt do anything i will just quit the class
  320. <penix_> "ass = cock[5];" is wrong, it should have been "ass = &cock[5];"
  321. <penix_> cock[5] == 'j', not an address
  322. <penix_> ass points to an address, so we need to do like &cock[5]
  323. <penix_> Let's do like "ass--;" which sets ass to cock[4]
  324. <penix_> cock[4] == 0, the null string terminator
  325. <penix_> if we try to print ass now, "printf("%s", ass);", we get "".
  326. <ScratXP> this is still goin gon?
  327. <ScratXP> huhu
  328. <penix_> Nothing, because the first character ass[0] is set to the null terminator.
  329. <ScratXP> the first character is arnold swartaznegger?
  330. <penix_> Let's over write that with " ", "ass[0] = ' ';"
  331. <ferrex> i think penix_ lost the point
  332. <penix_> Now we are back to what we started with. Let's point the ass back at cock: "ass = cock;"
  333. <penix_> And print it out: "printf("%s", ass);", which prints "shit jizz".
  334. <xyclone> wtf
  335. <penix_> As you can see, we are back to having shit and jizz in the ass.
  336. <penix_> And that concludes my pointer examples.
  337. <penix_> Again, the best way to learn this stuff is just to take your ass and cock and play with them.
  338. <mapp> lol
  339. <goog|e> and that concludes sex education for today
  340. * domo (~a@ Quit
  341. <penix_> wtf, stupid domo
  342. <vman_____> i think u mean homo :(
Add Comment
Please, Sign In to add comment