18062010

   1 <mohi1> [Jun 18 14:24:44] wb juju2143
   2 <juju2143>      [Jun 18 14:25:12] ...? 
   3 <mohi1> [Jun 18 14:25:31] juju2143, prepared for today's class?? 
   4 <juju2143>      [Jun 18 14:25:37] yeah 
   5 <mohi1> [Jun 18 14:25:56] cool =] 
   6 <juju2143>      [Jun 18 14:25:59] kinda 
   7 <juju2143>      [Jun 18 14:26:00] :D 
   8 <mohi1> [Jun 18 14:26:22] ^_^ 
   9 <pedro3005>     [Jun 18 15:09:13] hey phillw 
  10 <phillw>        [Jun 18 15:13:24] hi pedro3005 
  11 <pedro3005>     [Jun 18 15:14:20] phillw, how are you? 
  12 <phillw>        [Jun 18 15:16:14] I'm well, been a bit busy with accessibilty coding as I have some one who has experience in it and is willing to help me learn about it. 
  13 <pedro3005>     [Jun 18 15:18:19] Oh, accessibility.. I've never given that a thought 
  14 <mohi1> [Jun 18 15:20:09] pedro3005, where is Failbot/? 
  15 <pedro3005>     [Jun 18 15:20:42] mohi1, sleeping 
  16 <mohi1> [Jun 18 15:21:26] argh 
  17 <pedro3005>     [Jun 18 15:21:37] mohi1, why do you want him? 
  18 <mohi1> [Jun 18 15:22:02] I saw him before 2 months I think. So only asked ya 
  19 <phillw>        [Jun 18 15:44:58] so, do tell, why was there a note for me to log on here in ##devil? 
  20 <mohi1> [Jun 18 15:45:38] phillw, see the sessions running and guide us please and take some sessions too 
  21 <mohi1> [Jun 18 15:46:36] juju2143, you have 15 more minutes to start 
  22 <juju2143>      [Jun 18 15:46:57] kay 
  23 <phillw>        [Jun 18 15:47:16] let me know where the logs are and I will have look through them, but I'm no teacher ;-)
  24 <phillw>        [Jun 18 15:47:22] :-\ 
  25 <mohi1> [Jun 18 15:47:33] phillw, my friend still didn't upload it 
  26 <mohi1> [Jun 18 15:47:39] am waiting for that 
  27 <mohi1> [Jun 18 15:47:45] but i can pastebin it now 
  28 <mohi1> [Jun 18 15:50:08] phillw, read it if you can :P 
  29 <mohi1> [Jun 18 15:51:56] phillw, my current unknown issue http://ubuntuforums.org/showthread.php?t=1503483&highlight=lucid+compiz+with+GLX 
  30 <mohi1> [Jun 18 15:52:23] i just get the first two warnings when i run compiz 
  31 <phillw>        [Jun 18 15:53:13] i know nothing about compiz :-\ 
  32 <mohi1> [Jun 18 15:53:22] awwww 
  33 <mohi1> [Jun 18 15:53:31] pedro3005, how about you? 
  34 <pedro3005>     [Jun 18 15:53:43] even less than phillw 
  35 <mohi1> [Jun 18 15:53:56] hmmm 
  36 <phillw>        [Jun 18 16:01:08] the 1st time I knew about compiz was in lucid testing when someone told me to do a certain key-combination and I fell off my chair in shock when this 'cube' suddenly appeared... very quickly went back to 2-D :-D 
  37 <mohi1> [Jun 18 16:02:56] lol phillw 
  38 <mohi1> [Jun 18 16:03:06] juju2143, ITS TIME!!!!! 
  39 *       bikcmp [Jun 18 16:04:24] teaches Python? 
  40 <juju2143>      [Jun 18 16:04:36] OMG 
  41 <bikcmp>        [Jun 18 16:04:36] even worse, I teach bash :P 
  42 <bikcmp>        [Jun 18 16:04:37] lol 
  43 <juju2143>      [Jun 18 16:04:39] lol 
  44 <mohi1> [Jun 18 16:04:41] bikcmp, ok at what time? 
  45 <bikcmp>        [Jun 18 16:04:57] mohi1: oh, hehe 
  46 <bikcmp>        [Jun 18 16:05:03] well, i guess i'll do it, when? 
  47 <bikcmp>        [Jun 18 16:05:04] hehe 
  48 <bikcmp>        [Jun 18 16:05:17] if possible, i'd like to do it on my net, freenode's laggy today. 
  49 <bikcmp>        [Jun 18 16:05:18] hehe 
  50 <juju2143>      [Jun 18 16:05:20] Ok, everyone's there? 
  51 <bikcmp>        [Jun 18 16:05:36] er, no, lol, if they'd like, bring them there 
  52 <mohi1> [Jun 18 16:05:37] pedro3005, ping
  53 <bikcmp>        [Jun 18 16:05:39] C# sucks btw, lol 
  54 <bikcmp>        [Jun 18 16:05:42] c++ ftw 
  55 <bikcmp>        [Jun 18 16:05:45] and python 
  56 <juju2143>      [Jun 18 16:05:50] bikcmp, of course it's why I teach it
  57 <bikcmp>        [Jun 18 16:05:57] juju2143: c++? 
  58 <bikcmp>        [Jun 18 16:05:58] hah 
  59 <mohi1> [Jun 18 16:06:01] lol 
  60 <juju2143>      [Jun 18 16:06:01] C# 
  61 <bikcmp>        [Jun 18 16:06:18] i'm learning C++, since i know python well, I get it :) 
  62 <mohi1> [Jun 18 16:06:41] juju2143, you can begin 
  63 <mohi1> [Jun 18 16:06:57] ============================== DAY 2 C#  =========================== 
  64 <juju2143>      [Jun 18 16:07:00] Ok, Lesson 2. 
  65 <bikcmp>        [Jun 18 16:07:06] who's actually here? lol 
  66 <mohi1> [Jun 18 16:07:18] bikcmp, everything is logged 
  67 <bikcmp>        [Jun 18 16:07:24] oh, i see 
  68 <bikcmp>        [Jun 18 16:07:34] see the logs at: ? 
  69 <juju2143>      [Jun 18 16:07:34] Yesterday we looked at our first hello world. 
  70 <bikcmp>        [Jun 18 16:07:36] lol 
  71 <juju2143>      [Jun 18 16:07:41] lol 
  72 <mohi1> [Jun 18 16:07:49] bikcmp, tomorrow you will get the link :P 
  73 <bikcmp>        [Jun 18 16:07:56] ... goodie
  74 <bikcmp>        [Jun 18 16:07:57] lol 
  75 <bikcmp>        [Jun 18 16:08:06] i'll teach python side by side with juju2143 :P 
  76 <bikcmp>        [Jun 18 16:08:13] let's see your hello worl d;) 
  77 <juju2143>      [Jun 18 16:08:14] lol:P 
  78 <mohi1> [Jun 18 16:08:15] juju2143, todays class is about...... 
  79 <juju2143>      [Jun 18 16:08:20] Graphics 
  80 <mohi1> [Jun 18 16:08:24] cool
  81 <bikcmp>        [Jun 18 16:08:27] in python, print "hello world" 
  82 <juju2143>      [Jun 18 16:08:40] Yesterday, before we left off, we created a new GTK# project 
  83 <pedro3005>     [Jun 18 16:08:42] sorry I'm late 
  84 <bikcmp>        [Jun 18 16:09:00] devilbot: please don't hurt me 
  85 <devilbot>      [Jun 18 16:09:01] bikcmp: Thank you for your request.  I have no reason to do that to you. 
  86 <bikcmp>        [Jun 18 16:09:06] rofl 
  87 <juju2143>      [Jun 18 16:09:08] lol. 
  88 <mohi1> [Jun 18 16:09:13] lol 
  89 <bikcmp>        [Jun 18 16:09:16] devilbot: could you hurt juju2143 though? 
  90 <devilbot>      [Jun 18 16:09:17] bikcmp: Oh. I could but I don't know if I am that interested. 
  91 <bikcmp>        [Jun 18 16:09:22] devilbot: you are intrested. 
  92 <devilbot>      [Jun 18 16:09:24] bikcmp: I will tell my botmaster you said  I am intrested.
  93 <mohi1> [Jun 18 16:09:25] ;-ai 
  94 <devilbot>      [Jun 18 16:09:26] AI has been turned off
  95 <bikcmp>        [Jun 18 16:09:29] :( 
  96 <bikcmp>        [Jun 18 16:09:32] bring it on my net? lol 
  97 <bikcmp>        [Jun 18 16:09:40] i could have serious fun with that.
  98 <juju2143>      [Jun 18 16:09:41] lol 
  99 <juju2143>      [Jun 18 16:09:48] no mine.
 100 <mohi1> [Jun 18 16:09:48] bikcmp, ok laterz 
 101 <bikcmp>        [Jun 18 16:09:58] irc.fossnet.info #bots, when you get the time 
 102 <bikcmp>        [Jun 18 16:10:05] now, let's do some C--- 
 103 <pedro3005>     [Jun 18 16:10:10] bikcmp, are you experienced with PyGTK? It'd be interesting to have a course in it (seeing we already had a brief python one) 
 104 <juju2143>      [Jun 18 16:10:18] s/irc.fossnet.info/irc.57o9.org/ 
 105 <bikcmp>        [Jun 18 16:10:28] pedro3005: I'm pretty bad with graphics in python tbvh. 
 106 <bikcmp>        [Jun 18 16:10:44] i use python mainly for cgi and scripts for administrating my servers. [Jun 18 16:10:44]
 107 <bikcmp>        [Jun 18 16:10:46] all 5 OF THEM 
 108 <juju2143>      [Jun 18 16:10:50] Ok, day 2: C# language notions. 
 109 <bikcmp>        [Jun 18 16:11:29] ...go on 
 110 <bikcmp>        [Jun 18 16:11:31] lol 
 111 <juju2143>      [Jun 18 16:11:52] damn, my mom jst called me to tell me to go to shower. 
 112 *       bgs100 [Jun 18 19:13:00] notices that it is past 23:00 UTC! 
 113 <bgs100>        [Jun 18 19:13:06] Anyone around? 
 114 <pedro3005>     [Jun 18 19:13:17] hey 
 115 <bgs100>        [Jun 18 19:13:20] seidos, pedro3005 juju2143 mohi2911 ?
 116 <bgs100>        [Jun 18 19:13:24] Hi pedro3005
 117 *       bgs100 [Jun 18 19:13:46] looks around 
 118 <bgs100>        [Jun 18 19:14:00] Is anyone else around? :/ 
 119 <pedro3005>     [Jun 18 19:19:28] bgs100, this seems wrong to me 
 120 <pedro3005>     [Jun 18 19:20:04] I mean, we're actually offering a free course on C, you'd expect more people to show up 
 121 <bgs100>        [Jun 18 19:20:16] Lol, yeah 
 122 <bgs100>        [Jun 18 19:21:42] hmm 
 123 <bgs100>        [Jun 18 19:22:27] >_> 
 124 <bgs100>        [Jun 18 19:22:30] <_< 
 125 <pedro3005>     [Jun 18 19:22:41] bgs100, I actually have a proposition to make 
 126 <bgs100>        [Jun 18 19:22:48] What? 
 127 <pedro3005>     [Jun 18 19:23:15] bgs100, pm? 
 128 <bgs100>        [Jun 18 19:23:21] Okay 
 129 <seidos>        [Jun 18 19:28:16] I'm here now bgs100, I was eating lunch 
 130 <seidos>        [Jun 18 19:28:28] my mom was kind enough to prepare something 
 131 <bgs100>        [Jun 18 19:29:56] Ohai
 132 <bgs100>        [Jun 18 19:31:06] pedro3005, seidos So want to do the C class today? 
 133 <seidos>        [Jun 18 19:32:57] I'm game if pedro's game 
 134 <pedro3005>     [Jun 18 19:33:22] I'm in 
 135 <bgs100>        [Jun 18 19:33:35] Alright, cool 
 136 <seidos>        [Jun 18 19:33:39] hey bgs100 are you employed? 
 137 <bgs100>        [Jun 18 19:34:01] No, not old enough to be. 
 138 <seidos>        [Jun 18 19:34:10] ah 
 139 <bgs100>        [Jun 18 19:34:22] Okay 
 140 <seidos>        [Jun 18 19:34:34] how old are you?  I thought you were 100 :P 
 141 <bgs100>        [Jun 18 19:34:39] Lol 
 142 <bgs100>        [Jun 18 19:34:47] Naw, I'm just 
 143 <bgs100>        [Jun 18 19:34:52] 9000!!!!!! 
 144 <bgs100>        [Jun 18 19:34:54] (jk)
 145 <bgs100>        [Jun 18 19:34:59] Anyway 
 146 <bgs100>        [Jun 18 19:35:05] seidos, Do you have the homework?
 147 <seidos>        [Jun 18 19:35:16] yeah, but I couldn't get it to work right 
 148 <bgs100>        [Jun 18 19:35:24] hm
 149 <bgs100>        [Jun 18 19:35:28] Pastebin? 
 150 <seidos>        [Jun 18 19:35:33] an if statement isn't executing and I don't know why 
 151 <seidos>        [Jun 18 19:35:45] all right let me pastebin
 152 <bgs100>        [Jun 18 19:36:28] Okay
 153 <seidos>        [Jun 18 19:38:23] http://paste.ubuntu.com/451829/ 
 154 <seidos>        [Jun 18 19:38:50] bgs100 ^^ 
 155 <bgs100>        [Jun 18 19:39:02] Okay 
 156 <bgs100>        [Jun 18 19:40:42] seidos, It's because, 
 157 <bgs100>        [Jun 18 19:42:23] you're scanf()'ing within the if statement for them getting it wrong, so the other if isn't executed, then the next time it loops, it sees that num1 is the same as secret, so stops, and then the program ends 
 158 <bgs100>        [Jun 18 19:42:33] Also, if they get it right the first time, 
 159 <bgs100>        [Jun 18 19:42:53] then num1 == secret at the beginning of the first loop, so the body never runs 
 160 <bgs100>        [Jun 18 19:43:55] You could fix this by, instead of having and else if saying they won, butting the printf() after the for loop, which means they were successful. 
 161 <bgs100>        [Jun 18 19:45:00] And then, you don't need the first if statement because it's asking the same thing as the loop. 
 162 <bgs100>        [Jun 18 19:45:20] (you need to keep the body of it, though) 
 163 <bgs100>        [Jun 18 19:47:16] seidos ?
 164 <seidos>        [Jun 18 19:47:23] yeah, I'm reading what you wrote 
 165 <seidos>        [Jun 18 19:47:27] I'm also on the phone 
 166 <bgs100>        [Jun 18 19:47:40] Ah 
 167 <seidos>        [Jun 18 19:47:55] my friend is a teacher and had a tough day 
 168 <seidos>        [Jun 18 19:48:04] 8th graders 
 169 <seidos>        [Jun 18 19:48:12] at an inner city school 
 170 <bgs100>        [Jun 18 19:48:20] Ah... 
 171 <bgs100>        [Jun 18 19:48:43] Well, here's the fixed version (also removing the unused variable i): 
 172 <bgs100>        [Jun 18 19:48:47] http://paste.ubuntu.com/451833/ 
 173 <bgs100>        [Jun 18 19:49:02] Oh crap... 
 174 <bgs100>        [Jun 18 19:49:08] g2g, pedro3005 seidos ... 
 175 <bgs100>        [Jun 18 19:49:10] Sorry :( 
 176 <bgs100>        [Jun 18 19:49:19] Hopefully will be back 
 177 <bgs100>        [Jun 18 19:49:22] soon 
 178 <pedro3005>     [Jun 18 19:49:23] ah no problem bgs100 
 179 <pedro3005>     [Jun 18 19:49:34] thanks 
 180 <seidos>        [Jun 18 19:49:35] thank you 
 181 <pedro3005>     [Jun 18 19:49:41] I'll brb then
 182 <pedro3005>     [Jun 18 19:49:42] :D 
 183 <bgs100>        [Jun 18 19:49:57] np, but still sorry... hopefully be back in ajust a few minutes...
 184 <bgs100>        [Jun 18 20:07:50] Back 
 185 <bgs100>        [Jun 18 20:07:55] pedro3005, seidos Ping 
 186 <bgs100>        [Jun 18 20:09:08] ... 
 187 <seidos>        [Jun 18 20:13:53] sorry dude, still on the phone :| 
 188 <bgs100>        [Jun 18 20:19:06] Oh
 189 <seidos>        [Jun 18 20:28:44] okay I'm off 
 190 <seidos>        [Jun 18 20:28:54] sorry
 191 <seidos>        [Jun 18 20:29:11] ha, you're probably not here anymore :D 
 192 <bgs100>        [Jun 18 20:30:04] Yes 
 193 <bgs100>        [Jun 18 20:30:05] I am
 194 <bgs100>        [Jun 18 20:30:12] seidos, ^ 
 195 <bgs100>        [Jun 18 20:30:39] pedro3005, Are you here? 
 196 *       bgs100 [Jun 18 20:30:53] looks at attendance roll and seating chart 
 197 <pedro3005>     [Jun 18 20:37:02] bgs100, hi 
 198 <bgs100>        [Jun 18 20:37:29] Hai 
 199 *       bgs100 [Jun 18 20:37:38] wonders where seidos ran off to 
 200 <seidos>        [Jun 18 20:37:55] hey 
 201 <bgs100>        [Jun 18 20:37:57] pedro3005, Alright, well, ready to continue?
 202 <bgs100>        [Jun 18 20:38:01] Yay! 
 203 <pedro3005>     [Jun 18 20:38:01] sure 
 204 <seidos>        [Jun 18 20:38:03] just watching this video on DNA 
 205 <bgs100>        [Jun 18 20:38:05] seidos, Ready?
 206 <bgs100>        [Jun 18 20:38:08] Ah 
 207 <seidos>        [Jun 18 20:38:29] oh man, I need to download your code that fixed my HW 
 208 <bgs100>        [Jun 18 20:39:22] http://paste.ubuntu.com/451833/ 
 209 <seidos>        [Jun 18 20:39:47] I'm pretty disappointed, I thought the fix would be easier 
 210 <seidos>        [Jun 18 20:39:51] I really thought I was close 
 211 <bgs100>        [Jun 18 20:39:57] seidos, You were 
 212 <bgs100>        [Jun 18 20:40:07] In all, 
 213 <bgs100>        [Jun 18 20:40:17] you could have fixed it just by moving one line of code 
 214 <seidos>        [Jun 18 20:40:30] by moving a line of code, huh? 
 215 <seidos>        [Jun 18 20:40:54] why did you change it to a while loop? 
 216 <bgs100>        [Jun 18 20:41:09] Because i wasn't necessary 
 217 <bgs100>        [Jun 18 20:41:19] (the variable i) 
 218 <bgs100>        [Jun 18 20:41:25] You didn't do anything with it. 
 219 <pedro3005>     [Jun 18 20:41:35] #define print printf 
 220 <pedro3005>     [Jun 18 20:41:36] ?! 
 221 <seidos>        [Jun 18 20:41:48] ahhhh 
 222 <bgs100>        [Jun 18 20:41:52] pedro3005, Oh, 
 223 <bgs100>        [Jun 18 20:42:02] seidos was getting print mixed up with printf, 
 224 <seidos>        [Jun 18 20:42:03] bgs100 taught me that 
 225 <seidos>        [Jun 18 20:42:21] I put it in just to be..."creative" 
 226 <seidos>        [Jun 18 20:42:31] :P 
 227 <bgs100>        [Jun 18 20:42:32] so I told seidos they could do that (as a neat thing, I recommended seidos learns to type printf :p) 
 228 <pedro3005>     [Jun 18 20:42:37] bgs100, doesn't look like the greatest idea lol 
 229 <bgs100>        [Jun 18 20:42:39] s/they/he/ 
 230 <bgs100>        [Jun 18 20:42:55] pedro3005, It was something neat I decided to show seidos :p 
 231 <pedro3005>     [Jun 18 20:43:14] ok 
 232 <bgs100>        [Jun 18 20:43:14] ANYWAY
 233 <pedro3005>     [Jun 18 20:43:25] seidos, you probably shouldn't use it regularly though 
 234 <seidos>        [Jun 18 20:43:58] pedro3005, I don't think it will really matter. 
 235 <bgs100>        [Jun 18 20:45:35] Okay
 236 <bgs100>        [Jun 18 20:45:36] So 
 237 <bgs100>        [Jun 18 20:45:45] -----------------------------------------THE STANDARD LIBRARY!------------------------------------------ 
 238 <bgs100>        [Jun 18 20:45:49] *angels sing* 
 239 <bgs100>        [Jun 18 20:47:02] So 
 240 <bgs100>        [Jun 18 20:47:04] Yeah 
 241 <bgs100>        [Jun 18 20:47:31] Open up a shiny new text file 
 242 <bgs100>        [Jun 18 20:47:38] And I will pastebin the code
 243 <pedro3005>     [Jun 18 20:49:02] bgs100, I just saw someone do char** argv, does that work?
 244 <bgs100>        [Jun 18 20:49:11] Yeap
 245 <bgs100>        [Jun 18 20:49:23] Remember, array secretly == pointer 
 246 <bgs100>        [Jun 18 20:49:38] so argv[][], *argv[], and **argv are all the same
 247 <pedro3005>     [Jun 18 20:50:19] ok
 248 <seidos>        [Jun 18 20:51:03] ...hmmm doesn't really make sense, but I'll trust you
 249 <bgs100>        [Jun 18 20:51:23] It will later, so trust me then too
 250 <seidos>        [Jun 18 20:52:51] ok 
 251 <bgs100>        [Jun 18 20:55:09] Okay, here ya go:
 252 <bgs100>        [Jun 18 20:55:38] http://pastebin.com/RP0X57Dd 
 253 <bgs100>        [Jun 18 20:55:39] SCRO 
 254 <bgs100>        [Jun 18 20:55:45] pedro3005, seidos ^^^ 
 255 <pedro3005>     [Jun 18 20:57:20] bgs100, why did you import time.h? it's not necessary 
 256 <bgs100>        [Jun 18 20:57:32] Yes, it is. 
 257 <pedro3005>     [Jun 18 20:57:55] well, it compiles and runs without 
 258 <pedro3005>     [Jun 18 20:58:02] although it bitches
 259 <bgs100>        [Jun 18 20:58:05] Yes 
 260 <bgs100>        [Jun 18 20:58:12] it b*tches for a reason. 
 261 <pedro3005>     [Jun 18 20:58:48] bgs100, well, I understand the code :D 
 262 <bgs100>        [Jun 18 20:59:22] pedro3005, Do you understand srand(time(NULL)); ? 
 263 <pedro3005>     [Jun 18 20:59:28] yeah 
 264 <bgs100>        [Jun 18 20:59:32] Okay 
 265 <seidos>        [Jun 18 20:59:34] I kind of understand it 
 266 <bgs100>        [Jun 18 20:59:41] time.h is what provides time(NULL) 
 267 <bgs100>        [Jun 18 20:59:44] er, time() 
 268 <seidos>        [Jun 18 20:59:54] what does srand(time(NULL)) do? 
 269 <seidos>        [Jun 18 20:59:58] anything? 
 270 <bgs100>        [Jun 18 21:00:04] Yes, one sec 
 271 <pedro3005>     [Jun 18 21:00:05] it's essential 
 272 <pedro3005>     [Jun 18 21:00:10] it defines the seed of rand 
 273 <pedro3005>     [Jun 18 21:00:18] that is, where rand will get its numbers from 
 274 <bgs100>        [Jun 18 21:00:22] Who's the teacher here? :P 
 275 <bgs100>        [Jun 18 21:00:28] pedro3005, Eh, 
 276 <bgs100>        [Jun 18 21:00:34] not 'where' 
 277 <pedro3005>     [Jun 18 21:00:42] in this case, the seemingly random number is generated from the time the code is being run, I guess 
 278 <bgs100>        [Jun 18 21:00:53] Yes 
 279 <bgs100>        [Jun 18 21:00:57] ANYWAY 
 280 <pedro3005>     [Jun 18 21:01:05] bgs100, why not 'where'? 
 281 <bgs100>        [Jun 18 21:01:23] pedro3005, Since time.h standard gcc is a nice compiler and will let you get by with not including it, but it's bad practice not to when you're using it's definitions. 
 282 <pedro3005>     [Jun 18 21:01:37] ok 
 283 <bgs100>        [Jun 18 21:01:41] pedro3005, It just provides a starting number for rand and such to do lots of odd math on
 284 <bgs100>        [Jun 18 21:01:50] A 'seed' 
 285 <pedro3005>     [Jun 18 21:01:59] okay
 286 <bgs100>        [Jun 18 21:04:12] Okay 
 287 <bgs100>        [Jun 18 21:04:13] So
 288 <bgs100>        [Jun 18 21:04:39] In this source, you'll notice we have included so different files
 289 <bgs100>        [Jun 18 21:05:10] stdlib.h, and time.h
 290 <bgs100>        [Jun 18 21:05:21] stdlib.h for the functions rand and srand,
 291 <bgs100>        [Jun 18 21:05:31] time.h for time() 
 292 <bgs100>        [Jun 18 21:05:48] I just explained what srand does,
 293 <bgs100>        [Jun 18 21:06:42] rand() returns a not-actually-random number 
 294 <bgs100>        [Jun 18 21:06:57] based (originally) on what srand was given 
 295 <seidos>        [Jun 18 21:07:23] right, a quasi random number
 296 <bgs100>        [Jun 18 21:07:47] *nodes* time() is a function that, when passed NULL (Null is actually 0, but it represents some fancy stuff that has to do with pointers), return the number of seconds since this one arbitary date,
 297 <seidos>        [Jun 18 21:08:15] *nodes*? 
 298 <bgs100>        [Jun 18 21:08:17] 00:00:00 UTC, January 1, 1970
 299 <bgs100>        [Jun 18 21:08:22] seidos, 
 300 <bgs100>        [Jun 18 21:08:25] I meant *nods*
 301 <bgs100>        [Jun 18 21:08:27] sorry :p
 302 *       seidos [Jun 18 21:08:46] nods
 303 *       bgs100 [Jun 18 21:08:56] nods back 
 304 <bgs100>        [Jun 18 21:09:01] Anyway 
 305 <bgs100>        [Jun 18 21:09:24] So, the number of seconds since 1970 is a number that the user probably isn't exactly counting out. 
 306 <bgs100>        [Jun 18 21:09:33] Ohai Snova 
 307 <bgs100>        [Jun 18 21:09:58] Anyway 
 308 <seidos>        [Jun 18 21:10:20] ooookay 
 309 <bgs100>        [Jun 18 21:10:44] It's very often used as the random seed. 
 310 <seidos>        [Jun 18 21:10:54] so it will be quasi random because the user won't be trying to figure out the number of seconds on the clock 
 311 <seidos>        [Jun 18 21:11:11] or the difference in seconds
 312 <pedro3005>     [Jun 18 21:11:17] why do you get the rest of its division by 100? 
 313 <pedro3005>     [Jun 18 21:11:26] also, can't you set a range to rand()? 
 314 <bgs100>        [Jun 18 21:11:30] No.
 315 <bgs100>        [Jun 18 21:11:42] C does not have optional arguments. 
 316 <pedro3005>     [Jun 18 21:11:50] that bastard 
 317 *       bgs100 [Jun 18 21:12:07] takes away pedro3005's star "no cursing in class" 
 318 <bgs100>        [Jun 18 21:12:16] seidos, Yeah, that number itself will seem quite random, and then rand() does magic weird math to it, also 
 319 <pedro3005>     [Jun 18 21:12:16] bgs100, cursing
 320 <pedro3005>     [Jun 18 21:12:19] C is okay 
 321 <bgs100>        [Jun 18 21:12:31] anyway 
 322 <seidos>        [Jun 18 21:12:37] especially since it doesn't do anything
 323 <pedro3005>     [Jun 18 21:12:58] bgs100, so it'll come up with virtually anything?
 324 *       seidos [Jun 18 21:13:01] laughs at pedro3005 as his words fall away before hitting C
 325 <bgs100>        [Jun 18 21:13:02] pedro3005, We mod it by 100 so it will be in the range of 0 to 99, inclusive 
 326 <bgs100>        [Jun 18 21:13:05] pedro3005, yeah 
 327 <seidos>        [Jun 18 21:13:27] modulus?
 328 <bgs100>        [Jun 18 21:13:38] seidos, Yep 
 329 <pedro3005>     [Jun 18 21:13:45] bgs100, it'll be definitely in the range? 
 330 <bgs100>        [Jun 18 21:13:52] And then we add 1 to make it within the range of 1 - 100. 
 331 <seidos>        [Jun 18 21:14:01] I have hard time doing mods in my head 
 332 <bgs100>        [Jun 18 21:14:01] pedro3005, If not, something very serious is wrong.
 333 <seidos>        [Jun 18 21:14:15] but then, I have a hard time even doing some pretty basic arithmetic 
 334 <pedro3005>     [Jun 18 21:14:18] bgs100, that % is the same % as 10 % 3 = 1? 
 335 *       bgs100 [Jun 18 21:14:22] gives seidos a free calculator 
 336 <bgs100>        [Jun 18 21:14:34] pedro3005, Yes 
 337 <pedro3005>     [Jun 18 21:14:41] I don't get why it works 
 338 <seidos>        [Jun 18 21:14:43] I tried dividing 750,000,000,000 by 150,000,000 today and had to check on my calculator to make sure it was 5000
 339 *       bgs100 [Jun 18 21:15:08] shrugs 
 340 <bgs100>        [Jun 18 21:15:19] I would've double-checked too 
 341 <bgs100>        [Jun 18 21:15:25] Anyway 
 342 <bgs100>        [Jun 18 21:15:30] pedro3005, What do you mean? 
 343 <pedro3005>     [Jun 18 21:15:33] I see that it works 
 344 <pedro3005>     [Jun 18 21:15:43] but why is it never > 99?
 345 <bgs100>        [Jun 18 21:16:01] Well hopefully it should be able to be 100, thanks to that +1
 346 <seidos>        [Jun 18 21:16:12] it must be the % function
 347 <seidos>        [Jun 18 21:16:15] er operator 
 348 <pedro3005>     [Jun 18 21:16:16] well, you get what I mean 
 349 <pedro3005>     [Jun 18 21:16:18] >.> 
 350 <bgs100>        [Jun 18 21:16:27] Yeah 
 351 <bgs100>        [Jun 18 21:16:28] Okay 
 352 *       bgs100 [Jun 18 21:16:35] switches to, uh, math class mode 
 353 <bgs100>        [Jun 18 21:17:27] brb 
 354 <Snova> [Jun 18 21:18:59] % is division that results in the remainder, rather than the quotient [Jun 18 21:18:59]
 355 <bgs100>        [Jun 18 21:19:10] back
 356 <Snova> [Jun 18 21:19:23] if you moduli by 100 then you can't get a number above 100; such a number would have increased the quotient, no? 
 357 *       bgs100 [Jun 18 21:19:40] notices teaching assistance
 358 <seidos>        [Jun 18 21:20:06] which one is the quotient?  denominator?
 359 <bgs100>        [Jun 18 21:20:17] er 
 360 <Snova> [Jun 18 21:20:42] consider 150/100; quotient would be 1.5 or 1; remainder is 50 
 361 <seidos>        [Jun 18 21:20:48] hey fractions might help, if it's a whole fraction, there is no remainder 
 362 <seidos>        [Jun 18 21:21:04] ah dang it, quotient is the result
 363 <Snova> [Jun 18 21:21:21] i may have my terminology slightly incorrect; the point is % takes the remainder and is a convenient way to keep numbers within a certain range 
 364 <seidos>        [Jun 18 21:21:52] I need to do some more examples to solidify my understanding of %
 365 <pedro3005>     [Jun 18 21:21:55] Oh I see 
 366 <bgs100>        [Jun 18 21:22:04] pedro3005, If you multiply 100 as many times as it will go into n, and then take the difference, it can't be larger than greater than/equal to 100 or 100 would have gone in more times. 
 367 <pedro3005>     [Jun 18 21:22:14] yeah 
 368 <pedro3005>     [Jun 18 21:22:19] I understand now 
 369 <seidos>        [Jun 18 21:22:23] can you give me some more % examples? 
 370 <Snova> [Jun 18 21:22:23] seidos: 150 / 100 = 1r50; 150 % 100 = 50 
 371 <bgs100>        [Jun 18 21:22:24] Good 
 372 <bgs100>        [Jun 18 21:22:55] Somewhat ironically, I was about to bring up math.h 
 373 <seidos>        [Jun 18 21:23:12] like 2 % 1 -> 2/1 = 2 so 2 % 1 = 0 
 374 <Snova> [Jun 18 21:23:30] yep 
 375 <seidos>        [Jun 18 21:23:54] that's an easy one to understand and remember since there is no remainder 
 376 *       bgs100 [Jun 18 21:23:55] prepares to disengage math class mode 
 377 <seidos>        [Jun 18 21:24:08] I don't tend to think in terms of remainders anymore
 378 *       seidos [Jun 18 21:24:19] gets out of the way so he doesn't get hurt 
 379 <Snova> [Jun 18 21:24:20] modulo arithmetic actually comes up quite a lot; for example- a byte has 8 bits and a range of 0-255 (inclusive); what do you get if you increment a byte containing 255? 
 380 <pedro3005>     [Jun 18 21:24:56] two bytes? 
 381 <seidos>        [Jun 18 21:25:05] 16 bits? 
 382 <seidos>        [Jun 18 21:25:17] :P same diff as pedro3005's answer 
 383 <Snova> [Jun 18 21:25:25] you wish; it's zero
 384 <seidos>        [Jun 18 21:25:42] whoa 
 385 <Snova> [Jun 18 21:25:46] it's also been described as clock math; where 11 + 3 = 2 
 386 <Snova> [Jun 18 21:25:55] because it's actually (11 + 3) % 12 = 2 
 387 <seidos>        [Jun 18 21:25:55] isn't there some overflow buffer or something? 
 388 <Snova> [Jun 18 21:26:05] no, that's why you have larger numbers 
 389 <Snova> [Jun 18 21:26:08] er, larger types 
 390 <seidos>        [Jun 18 21:26:27] so the same is true for an int? 
 391 <Snova> [Jun 18 21:26:35] a byte is a byte is a byte; the most the cpu will do for you is set a flag informing you that the operation overflowed 
 392 <bgs100>        [Jun 18 21:26:37] seidos, Yes 
 393 <bgs100>        [Jun 18 21:26:47] Get a big enough int and suddenly you have a negative number
 394 <seidos>        [Jun 18 21:26:48] if you try to increment an int (what's the limit 65,xxx?), it will evaluate to 0?
 395 <Snova> [Jun 18 21:26:57] shorts have 16 bits and a limit of ~65000 
 396 <Snova> [Jun 18 21:27:08] er, unsigned ones 
 397 <Snova> [Jun 18 21:27:18] unsigned ints (32 bits) are about 4 billion; signed ones half that 
 398 <Snova> [Jun 18 21:27:41] anyway, are we done with math class yet? :) 
 399 <seidos>        [Jun 18 21:27:43] whoa, I didn't know that.  never thought of what would happen if you overflowed it. 
 400 <pedro3005>     [Jun 18 21:27:43] well, I don't know what is unsigned/signed 
 401 <bgs100>        [Jun 18 21:27:54] pedro3005,, 
 402 <Snova> [Jun 18 21:28:03] pedro3005: sign is a binary state (positive, negative), so signed ints use one bit to represent that
 403 <seidos>        [Jun 18 21:28:08] me neither, I assume signed has something to do with data integrity 
 404 <bgs100>        [Jun 18 21:28:17] Signed = One bit is dedicated to representing whether the number is positive or negative or not, 
 405 <seidos>        [Jun 18 21:28:24] how do you declare a signed int?
 406 <pedro3005>     [Jun 18 21:28:34] 'int' I guess 
 407 <bgs100>        [Jun 18 21:28:35] seidos, They are signed by default. 
 408 <Snova> [Jun 18 21:28:35] "int" or "signed int"; they're signed by default until you say "unsigned int" 
 409 <seidos>        [Jun 18 21:28:39] is it like sint number: 
 410 <pedro3005>     [Jun 18 21:28:48] bgs100, so an unsigned int is always positive? 
 411 <bgs100>        [Jun 18 21:28:54] pedro3005, Or 0. 
 412 <Snova> [Jun 18 21:28:58] pedro3005: and guess what happens if you overflow it? 
 413 <pedro3005>     [Jun 18 21:29:15] it becomes 0? 
 414 <Snova> [Jun 18 21:29:19] or larger, but yes 
 415 *       bgs100 [Jun 18 21:29:25] gives pedro3005 star back 
 416 <seidos>        [Jun 18 21:29:42] the same thing happens to signed and unsigned variables? 
 417 <Snova> [Jun 18 21:29:46] conveniently enough (or not), the sign bit is at the "top end" of ints, so if you overflow them you actually turn them negative 
 418 <seidos>        [Jun 18 21:29:52] if overflowed they evaluate to 0?
 419 <pedro3005>     [Jun 18 21:30:30] But is overflowing an actual danger we should be on the lookout for? 
 420 <seidos>        [Jun 18 21:30:39] you mean the sign bit negative, but not the actual value of the int right? 
 421 <Snova> [Jun 18 21:30:41] 2147483647 is the maximum positive number a signed int can hold; if you increment that by one you get -2147483647 or something 
 422 <Snova> [Jun 18 21:30:47] pedro3005: only if you're dealing with really big numbers, usually 
 423 <bgs100>        [Jun 18 21:30:57] pedro3005, Probably not. 
 424 <seidos>        [Jun 18 21:30:59] pedro3005,  it had something to do % math 
 425 <Snova> [Jun 18 21:32:11] pedro3005: if you're using normal ints you'd have to be dealing with numbers beyond 4 billion and something; if it becomes a problem unsigned 64-bit ints have a range of 18,446,744,073,709,551,615 (eighteen quintillion?) and if you go beyond *that*- there are "bigint" libraries to handle it 
 426 <bgs100>        [Jun 18 21:32:29] Wheeeeeeeee 
 427 <seidos>        [Jun 18 21:32:41] I couldn't even imagine applications that would use 18,446,744,073,709,551,615 
 428 <Snova> [Jun 18 21:32:57] the lesson: don't use small ints (shorts, chars) unless you actually have a reason to, and if you get weird negative numbers you might be overflowing something 
 429 <pedro3005>     [Jun 18 21:33:02] there is one part of physics which weighs the universe 
 430 <pedro3005>     [Jun 18 21:33:04] :P
 431 <pedro3005>     [Jun 18 21:33:34] bgs100, go on 
 432 <seidos>        [Jun 18 21:34:14] makes me wonder how many bits it would need to handle a googol 
 433 <seidos>        [Jun 18 21:34:19] I think that's how it's spelled 
 434 <bgs100>        [Jun 18 21:34:39] Okay 
 435 <bgs100>        [Jun 18 21:34:41] Well 
 436 <bgs100>        [Jun 18 21:35:50] Onto math.h 
 437 <bgs100>        [Jun 18 21:35:56] One sec 
 438 <Snova> [Jun 18 21:36:03] seidos: 333 
 439 <seidos>        [Jun 18 21:36:43] Snova, how did you figure it out? 
 440 <Snova> [Jun 18 21:37:28] seidos: math.log(10**100, 2) in python 
 441 <bgs100>        [Jun 18 21:37:34] Snova, ! 
 442 <pedro3005>     [Jun 18 21:37:44] On a side note, what are your favorite IDEs/text editors/however you like to program 
 443 <bgs100>        [Jun 18 21:37:53] You're going to make my students want to go to a python class instead! 
 444 <pedro3005>     [Jun 18 21:38:10] I bet it's like 30 lines of code in 
 445 <pedro3005>     [Jun 18 21:38:11] C 
 446 <Snova> [Jun 18 21:38:12] bgs100: what? I don't know the mathematical notation for logarithms of arbitrary bases :) (or C for that matter) 
 447 <pedro3005>     [Jun 18 21:38:18] god damn it I fail at typing today 
 448 <bgs100>        [Jun 18 21:38:27] pedro3005, Actually, no.
 449 <bgs100>        [Jun 18 21:38:32] In fact
 450 <Snova> [Jun 18 21:38:35] pedro3005: C has log(), I just don't know how to get a logarithm for something other than base 10 in C 
 451 <bgs100>        [Jun 18 21:38:39] Great introduction to math.h 
 452 <pedro3005>     [Jun 18 21:38:55] I'm trying out Netbeans and it just screams "bloated" 
 453 <bgs100>        [Jun 18 21:39:07] Lol 
 454 <Snova> [Jun 18 21:39:27] pedro3005: just because C is "lower-level" doesn't mean it requires reams of code; I've heard of assembly languages that were more compact than C 
 455 <seidos>        [Jun 18 21:40:01] I just tried math.log(10**100, 2) in python and it didn't work 
 456 <Snova> [Jun 18 21:40:21] import math; math.log(10**100, 2) 
 457 <bgs100>        [Jun 18 21:40:22] seidos, import math
 458 <seidos>        [Jun 18 21:40:34] crud, I was trying use math for some reason 
 459 <seidos>        [Jun 18 21:40:38] thanks 
 460 <seidos>        [Jun 18 21:41:12] man I suck at logs 
 461 <pedro3005>     [Jun 18 21:41:12] I don't really know what a log is
 462 <bgs100>        [Jun 18 21:41:25] logarithm; the inverse of exponentiation 
 463 <Snova> [Jun 18 21:41:26] pedro3005: think of it as the inverse of exponentiation 
 464 <Snova> [Jun 18 21:41:29] bah! 
 465 <seidos>        [Jun 18 21:41:35] it's like the log has a base, the base in the number 
 466 <bgs100>        [Jun 18 21:41:40] Snova, :D 
 467 <Snova> [Jun 18 21:41:44] pedro3005: if x^y = z then log(z, y) = x 
 468 <pedro3005>     [Jun 18 21:41:46] Snova, bgs100 won this round :p
 469 <seidos>        [Jun 18 21:41:48] what's the general form?
 470 <seidos>        [Jun 18 21:41:55] yeah, that's it 
 471 <bgs100>        [Jun 18 21:42:03] pedro3005, 5 to the power of 6 = 15625, and 15625 log 5 = 6 
 472 <bgs100>        [Jun 18 21:42:11] log (base) 5 
 473 <seidos>        [Jun 18 21:42:12] I always forget it after I look at it and figure it out 
 474 <seidos>        [Jun 18 21:42:21] it's like my brain wasn't designed for logs 
 475 <pedro3005>     [Jun 18 21:42:23] Alright
 476 <Snova> [Jun 18 21:42:39] bgs100: is that the notation? seidos's query would be "10^100 log 2" then 
 477 <seidos>        [Jun 18 21:43:09] I don't get what math.log is doing
 478 <seidos>        [Jun 18 21:43:20] is it taking log 2 of 10^100? 
 479 <seidos>        [Jun 18 21:43:21] must be
 480 <Snova> [Jun 18 21:43:23] yes 
 481 <Snova> [Jun 18 21:43:49] you wanted to know how many bits that would take. to find out the numerical range of a given number of bits, take 2^bits 
 482 <Snova> [Jun 18 21:44:03] so you want to know; 2^bits = 10^100 
 483 <Snova> [Jun 18 21:44:17] which is a simple application of a logarithm; 10^100 log 2 
 484 <seidos>        [Jun 18 21:44:17] yeah that's what I was doing, I was stupidly putting 2^x and substituting values of x 
 485 <Snova> [Jun 18 21:44:36] I've done it; now you know a better way 
 486 <seidos>        [Jun 18 21:44:47] I didn't even think logarithms were applicable 
 487 <seidos>        [Jun 18 21:44:59] unfortunately, I don't, I have to spend some time rethinking about logs to relearn them 
 488 <Snova> [Jun 18 21:45:03] we might not be moving through C very quickly, but at least we're getting some math in :p (some of it is foundational though, especially modulo arithmetic) 
 489 <seidos>        [Jun 18 21:45:51] hey Snova do you have a job? 
 490 <Snova> [Jun 18 21:45:55] nope 
 491 <seidos>        [Jun 18 21:46:05] how old are you? 
 492 <Snova> [Jun 18 21:46:29] 10 < x < 20 
 493 <Snova> [Jun 18 21:46:40] and older every second 
 494 <pedro3005>     [Jun 18 21:46:42] seidos, why do you keep asking that to everyone? 
 495 <Snova> [Jun 18 21:47:17] pedro3005: it's nice to have some idea of who you're talking to
 496 <seidos>        [Jun 18 21:47:24] because I'm 31 and live with my mom :D 
 497 <seidos>        [Jun 18 21:47:41] it makes me wonder how smart the 31 year old programmers are
 498 <seidos>        [Jun 18 21:48:21] if I knew c I'm sure I could find a job somewhere 
 499 <pedro3005>     [Jun 18 21:48:24] Snova, seems to me like lots of people aren't really comfortable saying their ages / etc 
 500 <Snova> [Jun 18 21:48:53] pedro3005: true 
 501 <seidos>        [Jun 18 21:48:57] I think if I had more scruples I'd be embarrassed of my age 
 502 <seidos>        [Jun 18 21:49:06] but I think I'm too old to care
 503 <pedro3005>     [Jun 18 21:49:28] aaaaaand back to C :P I'm almost falling asleep on my chair
 504 <bgs100>        [Jun 18 21:49:33] #include <stdio.h> 
 505 <bgs100>        [Jun 18 21:49:33] #include <math.h>
 506 <bgs100>        [Jun 18 21:49:33] int main() { 
 507 <bgs100>        [Jun 18 21:49:33]     printf("Square root of 25: %d\n", (int)sqrt(25)); 
 508 <bgs100>        [Jun 18 21:49:33]     printf("Sine of 42: %g\n", sin(42)); 
 509 <bgs100>        [Jun 18 21:49:34]     printf("93.2 rounded up: %d\n", (int)ceil(93.2)); 
 510 <bgs100>        [Jun 18 21:49:36]     printf("2 to the power of 333: %ld\n", (long)pow(2, 333)); 
 511 <bgs100>        [Jun 18 21:49:38]     return 0; 
 512 <bgs100>        [Jun 18 21:49:40] } 
 513 <bgs100>        [Jun 18 21:49:42] ERRR 
 514 <bgs100>        [Jun 18 21:49:44] CRAP 
 515 <bgs100>        [Jun 18 21:49:48] That was supposed to be a pastebin link :| 
 516 <bgs100>        [Jun 18 21:49:58] So ignore all of that 
 517 <bgs100>        [Jun 18 21:50:14] http://pastebin.com/UF0eCknA 
 518 <bgs100>        [Jun 18 21:50:41] pedro3005, seidos SCRO , but add this to your compile command: " -lm" 
 519 <pedro3005>     [Jun 18 21:51:24] Sine of 42: -0.916522 
 520 <pedro3005>     [Jun 18 21:51:36] isn't it supposed to be positive? 
 521 <bgs100>        [Jun 18 21:51:55] I don't know much about sines and such :p 
 522 <Snova> [Jun 18 21:52:00] not according to python 
 523 <Snova> [Jun 18 21:52:08] also, yes 
 524 <pedro3005>     [Jun 18 21:52:19] Well, if you draw the circle, the first quadrant has positive sine and cosines 
 525 <pedro3005>     [Jun 18 21:52:25] since x and y are positives 
 526 <pedro3005>     [Jun 18 21:52:30] 42 is in the first quadrant 
 527 <Snova> [Jun 18 21:52:34] hm, that would make sense 
 528 <bgs100>        [Jun 18 21:52:56] Um 
 529 <bgs100>        [Jun 18 21:53:01] Notice the last line 
 530 <bgs100>        [Jun 18 21:53:17] (that's the error I *wanted* you to find) 
 531 <bgs100>        [Jun 18 21:53:26] 2 to the power of 333: 2147483647 
 532 <Snova> [Jun 18 21:53:31] hehe 
 533 <seidos>        [Jun 18 21:53:33] 42 is in the first quadrant but -.916 is in the 4th 
 534 <bgs100>        [Jun 18 21:53:39] There's the magic number referenced earlier ;) 
 535 <bgs100>        [Jun 18 21:54:29] Anyway 
 536 <bgs100>        [Jun 18 21:54:39] Maybe I shouldn't have gone into math.h... 
 537 <bgs100>        [Jun 18 21:54:46] :P 
 538 <pedro3005>     [Jun 18 21:54:46] bgs100, oh yeah, googol 
 539 <pedro3005>     [Jun 18 21:54:52] why is it wrong? 
 540 <bgs100>        [Jun 18 21:54:59] Ahem,
 541 <pedro3005>     [Jun 18 21:55:10] google also says sine of 42 is negative 
 542 <Snova> [Jun 18 21:55:13] pedro3005: note that number is 2**31 - 1; i.e. it's the maximum of a signed int
 543 <bgs100>        [Jun 18 21:55:15] <Snova> 2147483647 is the maximum positive number a signed int can hold 
 544 <pedro3005>     [Jun 18 21:55:31] oh, right
 545 <seidos>        [Jun 18 21:56:25] why is it 2^333?
 546 <seidos>        [Jun 18 21:56:39] shouldn't it be something to do with 32bit? 
 547 <pedro3005>     [Jun 18 21:56:47] bgs100 chose 2^333
 548 <Snova> [Jun 18 21:56:48] in theory you'd get 10^100 with that, a googol 
 549 <seidos>        [Jun 18 21:56:56] ah 
 550 <Snova> [Jun 18 21:56:57] it is meant to illustrate integer limits 
 551 <bgs100>        [Jun 18 21:57:03] Yeah 
 552 <seidos>        [Jun 18 21:57:06] so it didn't overflow
 553 <seidos>        [Jun 18 21:57:13] I mean, it stopped at the maximum 
 554 <bgs100>        [Jun 18 21:57:20] Apparently not
 555 <pedro3005>     [Jun 18 21:57:49] if I try to change it to unsigned long, it says 2^333 = -1 
 556 <Snova> [Jun 18 21:57:56] that is the result of an implementation detail in pow()
 557 <Snova> [Jun 18 21:57:58] "If the result overflows, a range error occurs, and the functions return HUGE_VAL, HUGE_VALF, or HUGE_VALL, respectively, with the mathematically correct sign." 
 558 <seidos>        [Jun 18 21:58:56] what's pow() 
 559 <bgs100>        [Jun 18 21:58:57] Hm, 
 560 <Snova> [Jun 18 21:59:00] exponentiation 
 561 <Snova> [Jun 18 21:59:05] C has no builtin exponentiation operator
 562 <seidos>        [Jun 18 21:59:07] oh, power 
 563 <bgs100>        [Jun 18 21:59:11] seidos, The C standard for function for exponentiation 
 564 <bgs100>        [Jun 18 21:59:34] After changing the "(long)" to "(long long int)", the last line becomes:
 565 <bgs100>        [Jun 18 21:59:35] 2 to the power of 333: 9223372036854775807 
 566 <Snova> [Jun 18 21:59:38] also, I suspect the reason sin(42) returns such an odd number is that is expects radians 
 567 <Snova> [Jun 18 22:00:01] if you convert 42 to radians first, you get 0.67
 568 <pedro3005>     [Jun 18 22:00:06] oh yeah, maybe it is in radians 
 569 <pedro3005>     [Jun 18 22:01:01] bgs100, well, math isn't difficult, most of what we need can be solved by a quick google 
 570 <bgs100>        [Jun 18 22:01:09] Yes,
 571 <pedro3005>     [Jun 18 22:01:17] no real need to go over it in class 
 572 <seidos>        [Jun 18 22:01:26] I like it
 573 <seidos>        [Jun 18 22:01:33] :( 
 574 <pedro3005>     [Jun 18 22:01:42] ok sorry seidos :p
 575 <bgs100>        [Jun 18 22:01:48] but I would think it to be much easier to use a math function in your program than to connect to the net and retrieve and parse a page from Google in your program ;) 
 576 <seidos>        [Jun 18 22:01:51] it's cool, it's the teacher's class
 577 <seidos>        [Jun 18 22:01:59] I just wouldn't go over this math stuff otherwise 
 578 <seidos>        [Jun 18 22:02:05] I mean when do I ever use logs? 
 579 <seidos>        [Jun 18 22:02:14] or even trig functions 
 580 <bgs100>        [Jun 18 22:02:19] seidos, 
 581 <Snova> [Jun 18 22:02:27] whenever you feel the need to invert a power, and whenever you need to do something fancy with triangles/circles, I guess 
 582 <bgs100>        [Jun 18 22:02:32] You use logs when you want to find how many bits would be needed to represent a google 
 583 <bgs100>        [Jun 18 22:02:39] googol* 
 584 <bgs100>        [Jun 18 22:02:53] Stupid company names :p 
 585 <seidos>        [Jun 18 22:03:06] my point is, outside of this class, I have no problems to work on 
 586 <Snova> [Jun 18 22:03:10] I recall they named it after "a common misspelling of the word googol" 
 587 <bgs100>        [Jun 18 22:03:30] Now it's a more common misspelling. 
 588 <Snova> [Jun 18 22:03:34] indeed 
 589 <seidos>        [Jun 18 22:03:44] I almost mispelled it
 590 <bgs100>        [Jun 18 22:03:57] Changing (long long int) to (long double) changes the final line: 
 591 <bgs100>        [Jun 18 22:03:57] 2 to the power of 333: 1.7498e+100 
 592 <seidos>        [Jun 18 22:04:03] I need to improve my memory 
 593 <bgs100>        [Jun 18 22:04:19] seidos, But you misspelled misspelled instead :p
 594 <seidos>        [Jun 18 22:04:38] bgs100, no I recalled googol was the proper spelling, right? 
 595 <bgs100>        [Jun 18 22:04:42] seidos, no, 
 596 <seidos>        [Jun 18 22:04:46] ah crap 
 597 <seidos>        [Jun 18 22:04:50] lol
 598 <pedro3005>     [Jun 18 22:04:53] seidos, you're just so impatient for practicalities 
 599 <bgs100>        [Jun 18 22:05:02] I'm saying instead you misspelled 'misspelled' as 'mispelled' xP 
 600 <bgs100>        [Jun 18 22:05:27] ANYWAY 
 601 <bgs100>        [Jun 18 22:05:30] ON WITH THE C 
 602 <pedro3005>     [Jun 18 22:05:35] I mean, it's a long way until programming something useful 
 603 <seidos>        [Jun 18 22:05:39] you make no sense, sir
 604 <seidos>        [Jun 18 22:05:44] on with the C
 605 <bgs100>        [Jun 18 22:05:48] seidos, <seidos> I almost mispelled it 
 606 <bgs100>        [Jun 18 22:05:59] You misspelled the word "misspelled". 
 607 <seidos>        [Jun 18 22:06:06] ohhhhh 
 608 <bgs100>        [Jun 18 22:06:09] Lol.
 609 <seidos>        [Jun 18 22:06:17] didn't even know I was misspelling the word misspelled 
 610 <seidos>        [Jun 18 22:06:24] I should pay more attention to the spell checker 
 611 <bgs100>        [Jun 18 22:06:30] ANYWAY 
 612 <bgs100>        [Jun 18 22:06:32] ON WITH THE C 
 613 <seidos>        [Jun 18 22:06:32] I am too arrogant in my spelling habits 
 614 <seidos>        [Jun 18 22:06:34] sorry
 615 <bgs100>        [Jun 18 22:06:41] np :p 
 616 <seidos>        [Jun 18 22:06:43] *ability rather 
 617 <bgs100>        [Jun 18 22:06:44] ON WITH THE C 
 618 <pedro3005>     [Jun 18 22:06:49] go on 
 619 <bgs100>        [Jun 18 22:06:59] ONWARDS, TO STDLIB.H 
 620 <seidos>        [Jun 18 22:07:12] wait! 
 621 <seidos>        [Jun 18 22:07:15] one question 
 622 <seidos>        [Jun 18 22:07:20] how did you change the last line 
 623 <bgs100>        [Jun 18 22:07:20] Everyone put on your war helmets, we- 
 624 <bgs100>        [Jun 18 22:07:22] what 
 625 <seidos>        [Jun 18 22:07:25] for pow 
 626 <seidos>        [Jun 18 22:07:30] to long double?
 627 <bgs100>        [Jun 18 22:07:34]     printf("2 to the power of 333: %Lg\n", (long double)pow(2, 333)); 
 628 <pedro3005>     [Jun 18 22:07:56] not Ld? 
 629 <bgs100>        [Jun 18 22:08:00] No 
 630 <pedro3005>     [Jun 18 22:08:11] oh right 
 631 <pedro3005>     [Jun 18 22:08:13] okay 
 632 <pedro3005>     [Jun 18 22:08:14] on with the C 
 633 <bgs100>        [Jun 18 22:08:16] ld is long int, lld is long long int, 
 634 <bgs100>        [Jun 18 22:08:22] and then you need long double 
 635 <bgs100>        [Jun 18 22:08:25] SO YEAH 
 636 <bgs100>        [Jun 18 22:08:29] WITH THE C 
 637 <bgs100>        [Jun 18 22:08:31] ONWARDS 
 638 <seidos>        [Jun 18 22:08:37] I get a warning with that 
 639 <bgs100>        [Jun 18 22:08:42] Everyone put on your war helmets, we're hea- 
 640 <bgs100>        [Jun 18 22:08:44] what 
 641 <seidos>        [Jun 18 22:08:47] and it evaluates to 0 
 642 <bgs100>        [Jun 18 22:08:53] ... 
 643 <Snova> [Jun 18 22:08:59] heehe 
 644 <bgs100>        [Jun 18 22:08:59] It works fine here, so... 
 645 <Snova> [Jun 18 22:09:05] ONWARDS 
 646 <seidos>        [Jun 18 22:09:05]  printf("2 to the power of 333: %ld\n", (long double)pow(2, 333)); 
 647 <bgs100>        [Jun 18 22:09:11] Snova, VERILY!!! 
 648 <seidos>        [Jun 18 22:09:13] all right, onwards 
 649 <Snova> [Jun 18 22:09:17] seidos: ld is long int 
 650 <bgs100>        [Jun 18 22:09:18] seidos, NO 
 651 <bgs100>        [Jun 18 22:09:22] seidos, Lg, not ld 
 652 <bgs100>        [Jun 18 22:09:29]     printf("2 to the power of 333: %Lg\n", (long double)pow(2, 333)); [Jun 18 22:09:29]
 653 <bgs100>        [Jun 18 22:09:39] ... 
 654 <bgs100>        [Jun 18 22:09:41] onwards? 
 655 <Snova> [Jun 18 22:09:46] seidos: there's about a million formatters for printf; install manpages-dev and see "man 3 printf" if you want to bore yourself 
 656 <pedro3005>     [Jun 18 22:09:46] yes please 
 657 <Snova> [Jun 18 22:09:49] bgs100: hey, this is C 
 658 <bgs100>        [Jun 18 22:09:57] Snova, hm? 
 659 <seidos>        [Jun 18 22:10:01] onwards
 660 <bgs100>        [Jun 18 22:10:11] ONWARDS, TO STDLIB.H 
 661 <Snova> [Jun 18 22:10:12] bgs100: this is C, we're just on stdio.h rather than stdlib.h :p 
 662 <bgs100>        [Jun 18 22:10:20] Everyone put on your war helmets, we're heading- 
 663 <Snova> [Jun 18 22:10:25] and there's about a million things there 
 664 <bgs100>        [Jun 18 22:10:41] interrupted again... xP 
 665 <bgs100>        [Jun 18 22:10:49] Snova, More file processing is later 
 666 <pedro3005>     [Jun 18 22:10:56] ===== stdlib.h ====== 
 667 <bgs100>        [Jun 18 22:10:58] and such 
 668 <pedro3005>     [Jun 18 22:11:00] go on 
 669 <bgs100>        [Jun 18 22:11:02] pedro3005, thanks
 670 <bgs100>        [Jun 18 22:11:05] ONWARDS, TO STDLIB.H 
 671 <bgs100>        [Jun 18 22:11:25] Everyone put on your war helmets, we're heading into m/c/realloc()/free() territory! 
 672 <bgs100>        [Jun 18 22:11:30] :p 
 673 <Snova> [Jun 18 22:11:35] hope you've explained pointers 
 674 <bgs100>        [Jun 18 22:11:44] Yep 
 675 <Snova> [Jun 18 22:11:46] if not, prepare for a lot more than you bargained for, because that's never come very easily
 676 <Snova> [Jun 18 22:11:49] oh good 
 677 <bgs100>        [Jun 18 22:11:58] We're going a bit deeper in this time. 
 678 *       seidos [Jun 18 22:12:00] hopes he remembers his explanation
 679 *       bgs100 [Jun 18 22:12:10] hopes so too. 
 680 *       bgs100 [Jun 18 22:12:20] equips war helmet
 681 <seidos>        [Jun 18 22:12:20] I don't think any amount of body armor is going to help 
 682 <Snova> [Jun 18 22:12:28] well, free() is when mr. tycoon evicts people... ^_^
 683 <bgs100>        [Jun 18 22:12:33] Good point... 
 684 <bgs100>        [Jun 18 22:12:36] Snova, LOL. 
 685 <seidos>        [Jun 18 22:13:05] pedro3005, did you get that one? 
 686 <bgs100>        [Jun 18 22:13:06] seidos, Correct, the pointers know you're exact location, inside all of your body armour... 
 687 <pedro3005>     [Jun 18 22:13:15] seidos, nope... 
 688 <pedro3005>     [Jun 18 22:13:19] must be a programmer's joke 
 689 <seidos>        [Jun 18 22:13:25] all right, I'm not totally doomed 
 690 <bgs100>        [Jun 18 22:13:33] pshaw, you guys are programmers
 691 *       bgs100 [Jun 18 22:13:41] gives you both official badges 
 692 <Snova> [Jun 18 22:13:45] long story; I didn't expect anyone but bgs100 to get that one :p 
 693 <bgs100>        [Jun 18 22:14:01] wait I was supposed to get it? 
 694 <bgs100>        [Jun 18 22:14:10] (just kidding) 
 695 <Snova> [Jun 18 22:14:27] and if you ask what the story is I'm going to put on my drill sargeant hat and yell at you 
 696 <pedro3005>     [Jun 18 22:14:40] onwards to STDLIB.H 
 697 <bgs100>        [Jun 18 22:14:46] okay coo, then
 698 <bgs100>        [Jun 18 22:14:49] cpp;* 
 699 <bgs100>        [Jun 18 22:14:51] cool* 
 700 <bgs100>        [Jun 18 22:14:54] STUPID KEYBOARD
 701 <bgs100>        [Jun 18 22:15:04] anyway 
 702 <pedro3005>     [Jun 18 22:15:05] cpp? I thought this was C 
 703 <pedro3005>     [Jun 18 22:15:07] :P 
 704 <bgs100>        [Jun 18 22:15:09] brb, making example 
 705 <bgs100>        [Jun 18 22:15:14] pedro3005, lol, nice. 
 706 <bgs100>        [Jun 18 22:21:02] http://pastebin.com/iPtxQJVn 
 707 <bgs100>        [Jun 18 22:21:05] SCRO 
 708 <bgs100>        [Jun 18 22:21:12] pedro3005, seidos ^ 
 709 <seidos>        [Jun 18 22:21:48] bgs100, what's a good name for this file? 
 710 <bgs100>        [Jun 18 22:21:56] 9.c ? 
 711 <bgs100>        [Jun 18 22:21:57] :p 
 712 <seidos>        [Jun 18 22:21:59] stdlib sounds good 
 713 <bgs100>        [Jun 18 22:22:14] seidos, malloc would be good too.
 714 <seidos>        [Jun 18 22:22:15] I want to be able to reference them later, when I *know* I forget stuff 
 715 <seidos>        [Jun 18 22:23:04] -lm flag for compiler still?
 716 <Snova> [Jun 18 22:23:24] no 
 717 <pedro3005>     [Jun 18 22:23:29] sizeof(int)? 
 718 <Snova> [Jun 18 22:23:32] -lm links in the math library, which is separate for some stupid reason 
 719 *       pedro3005 [Jun 18 22:23:33] dies 
 720 <Snova> [Jun 18 22:23:36] we're not using it right now 
 721 <Snova> [Jun 18 22:23:47] pedro3005: it will return 4, if that explains anything 
 722 <seidos>        [Jun 18 22:23:52] it still worked, but I'll recompile 
 723 <bgs100>        [Jun 18 22:23:54] pedro3005, Lol.
 724 <Snova> [Jun 18 22:23:57] seidos: either way 
 725 <bgs100>        [Jun 18 22:24:02] pedro3005, All shall be explained
 726 <bgs100>        [Jun 18 22:24:07] Well 
 727 <bgs100>        [Jun 18 22:24:09] Maybe not all
 728 <seidos>        [Jun 18 22:24:26] 0 for starters, then 42
 729 <bgs100>        [Jun 18 22:24:26] But close enough for now.
 730 <Snova> [Jun 18 22:24:32] "and that concludes today's lessons; the remaining mysteries I leave as homework"? 
 731 <bgs100>        [Jun 18 22:24:38] Snova, xD 
 732 <pedro3005>     [Jun 18 22:25:08] bgs100, be sure to assign some homework 
 733 <pedro3005>     [Jun 18 22:25:16] was it  you that explained structs? 
 734 <pedro3005>     [Jun 18 22:25:27] I don't remember it very well 
 735 <bgs100>        [Jun 18 22:25:30] I did yesterday.
 736 <bgs100>        [Jun 18 22:25:35] xd 
 737 <pedro3005>     [Jun 18 22:25:36] ok go on with malloc 
 738 <seidos>        [Jun 18 22:25:56] me neither 
 739 <bgs100>        [Jun 18 22:25:57] Snova, I imagine a C language teacher coming into a class, writing the classic hello world on the board, and then saying "This concludes the class, your homework is to learn the rest of C." 
 740 <bgs100>        [Jun 18 22:26:20] Okay 
 741 <bgs100>        [Jun 18 22:26:21] So 
 742 <bgs100>        [Jun 18 22:26:36] First, sizeof
 743 <pedro3005>     [Jun 18 22:26:52] oh that one is easy
 744 <pedro3005>     [Jun 18 22:27:00] it's the size of something 
 745 <pedro3005>     [Jun 18 22:27:02] :P
 746 <Snova> [Jun 18 22:27:06] in bytes, to be exact 
 747 <bgs100>        [Jun 18 22:27:14] <look of dissapproval> 
 748 <bgs100>        [Jun 18 22:27:27] I'm going to continue with what I was saying anyway 
 749 <Snova> [Jun 18 22:27:37] s/ss/s/ 
 750 <bgs100>        [Jun 18 22:27:37] sizeof (in the way we're using it) will tell you the number of bytes in a datatype.
 751 <bgs100>        [Jun 18 22:27:43] Snova, Yes, i know 
 752 <bgs100>        [Jun 18 22:27:45] I* 
 753 <bgs100>        [Jun 18 22:28:19] sizeof(int) varies depending on the system. 
 754 <Snova> [Jun 18 22:28:36] officially; you're pretty much going to get 4 anywhere you go
 755 <bgs100>        [Jun 18 22:28:43] sizeof most stuff varies depending on the system, except for sizeof(char) 
 756 <bgs100>        [Jun 18 22:28:51] Snova, sssh 
 757 <bgs100>        [Jun 18 22:29:06] A char is always one byte. 
 758 <bgs100>        [Jun 18 22:29:08] So yeah 
 759 <bgs100>        [Jun 18 22:29:18] Then, we get to malloc
 760 <bgs100>        [Jun 18 22:29:30] Does anyone here (BESIDES SNOVA) know what it stands for? 
 761 <seidos>        [Jun 18 22:29:40] m-allocation? 
 762 <pedro3005>     [Jun 18 22:29:52] master allocation 
 763 <pedro3005>     [Jun 18 22:29:55] meta allocation 
 764 <bgs100>        [Jun 18 22:29:57] seidos, You have allocation correct, 
 765 <Snova> [Jun 18 22:29:59] seidos: close, but this isn't string theory 
 766 <bgs100>        [Jun 18 22:30:00] what about the m?
 767 <bgs100>        [Jun 18 22:30:06] Snova, lol 
 768 <seidos>        [Jun 18 22:30:13] haha 
 769 <bgs100>        [Jun 18 22:30:14] pedro3005, fail and fail 
 770 <pedro3005>     [Jun 18 22:30:28] mister allocation
 771 <pedro3005>     [Jun 18 22:30:30] he is grumpy 
 772 <bgs100>        [Jun 18 22:30:36] Lol. 
 773 <bgs100>        [Jun 18 22:30:37] No. 
 774 <seidos>        [Jun 18 22:30:43] multi? 
 775 <bgs100>        [Jun 18 22:30:47] It stands for... (calls on Snova) 
 776 <Snova> [Jun 18 22:30:54] MAGGOTS 
 777 <bgs100>        [Jun 18 22:30:57] XD 
 778 <Snova> [Jun 18 22:31:09] memory 
 779 <pedro3005>     [Jun 18 22:31:09] memory! 
 780 <pedro3005>     [Jun 18 22:31:10] :D 
 781 <bgs100>        [Jun 18 22:31:15] Lol. 
 782 <pedro3005>     [Jun 18 22:31:17] ok I googled it 
 783 <bgs100>        [Jun 18 22:31:22] Man 
 784 *       seidos [Jun 18 22:31:24] bangs his head and chants stupid 
 785 <bgs100>        [Jun 18 22:31:27] I was about to give you a star
 786 <bgs100>        [Jun 18 22:31:35] seidos, pedro googled it :p 
 787 <bgs100>        [Jun 18 22:31:47] At least you didn't cheat
 788 <seidos>        [Jun 18 22:31:50] that's a good idea, I have too many tabs open already 
 789 <bgs100>        [Jun 18 22:31:59] HEY 
 790 <bgs100>        [Jun 18 22:32:01] BAD IDEA 
 791 <bgs100>        [Jun 18 22:32:05] IT'S CHEATING 
 792 <bgs100>        [Jun 18 22:32:12] :p 
 793 <bgs100>        [Jun 18 22:32:14] Okay
 794 <bgs100>        [Jun 18 22:32:20] So what this does is 
 795 <bgs100>        [Jun 18 22:32:31] clear up 4 bytes of space in your memory. 
 796 <pedro3005>     [Jun 18 22:32:46] why 4?
 797 <bgs100>        [Jun 18 22:32:46] And then it gives freaky_pointer the address of the start of these 
 798 <Snova> [Jun 18 22:32:51] pedro3005: the size of an int 
 799 <bgs100>        [Jun 18 22:32:55] pedro3005, That's how many bytes are in an int
 800 <bgs100>        [Jun 18 22:32:58] Darn it 
 801 <bgs100>        [Jun 18 22:33:00] Beaten 
 802 <pedro3005>     [Jun 18 22:33:02] oh cool 
 803 <bgs100>        [Jun 18 22:33:15] pedro3005, Yeah, that's why we have sizeof(int) there. 
 804 <Snova> [Jun 18 22:33:18] pedro3005: malloc() allocates a certain number of bytes; allocating sizeof(int) means... ? 
 805 <pedro3005>     [Jun 18 22:33:32] allocating an int 
 806 <seidos>        [Jun 18 22:33:36] malloc(4) 
 807 *       bgs100 [Jun 18 22:33:37] claps 
 808 *       bgs100 [Jun 18 22:33:44] gives pedro3005 a star 
 809 *       bgs100 [Jun 18 22:33:48] gives seidos  a star 
 810 *       bgs100 [Jun 18 22:33:54] gives Snova a star 
 811 *       bgs100 [Jun 18 22:34:01] gives bgs100 a star 
 812 *       bgs100 [Jun 18 22:34:06] gives bgs100 5 stars 
 813 <bgs100>        [Jun 18 22:34:10] Anyway 
 814 <seidos>        [Jun 18 22:34:20] what does the * in *freaky_pointer do? 
 815 <bgs100>        [Jun 18 22:34:20] Now that we are all shiny.
 816 <bgs100>        [Jun 18 22:34:32] seidos, Gets the value at the address freaky_pointer holds 
 817 <Snova> [Jun 18 22:34:37] seidos: obtains the value that the pointer is pointing to, in this case an int 
 818 <Snova> [Jun 18 22:34:45] either that or is used to set it; same idea 
 819 <seidos>        [Jun 18 22:34:55] weird 
 820 <bgs100>        [Jun 18 22:35:07] You said it made sense, yesterday :P
 821 <bgs100>        [Jun 18 22:35:15] anyway
 822 <bgs100>        [Jun 18 22:35:17] So 
 823 <bgs100>        [Jun 18 22:35:42] We pretty much just manually (sort of) created a integer 
 824 *       bgs100 [Jun 18 22:35:55] creates another example 
 825 <pedro3005>     [Jun 18 22:37:02] why is malloc needed? 
 826 <Snova> [Jun 18 22:37:29] it's not, and there's no reason to allocate one int with it 
 827 <Snova> [Jun 18 22:37:36] usually 
 828 <pedro3005>     [Jun 18 22:37:43] ever? 
 829 <pedro3005>     [Jun 18 22:37:59] in which case would malloc be useful? 
 830 <seidos>        [Jun 18 22:38:04] no wonder we need a war helmet 
 831 <Snova> [Jun 18 22:38:18] larger allocations, and passing memory up the stack
 832 <Snova> [Jun 18 22:38:24] +without globals
 833 <bgs100>        [Jun 18 22:38:25] pedro3005, Many cases 
 834 <bgs100>        [Jun 18 22:38:32] we will get to those later
 835 <Snova> [Jun 18 22:38:35] also, dynamic allocations; most major reason
 836 <bgs100>        [Jun 18 22:38:36] Here is the example: 
 837 <bgs100>        [Jun 18 22:38:43] Snova, yeah 
 838 <bgs100>        [Jun 18 22:38:53] s/yeah/+1/ 
 839 <bgs100>        [Jun 18 22:39:13] http://pastebin.com/RadyCQLg 
 840 <bgs100>        [Jun 18 22:39:17] SCRO 
 841 <bgs100>        [Jun 18 22:39:24] pedro3005, seidos ^ 
 842 <bgs100>        [Jun 18 22:39:44] Also, might want to open a memory usage monitor 
 843 <pedro3005>     [Jun 18 22:40:10] I killed it 
 844 <bgs100>        [Jun 18 22:40:17] Good. 
 845 <bgs100>        [Jun 18 22:40:26] seidos ?
 846 <bgs100>        [Jun 18 22:40:52] ... 
 847 <seidos>        [Jun 18 22:40:59] I took a little while to kill it 
 848 <bgs100>        [Jun 18 22:41:02] Ah 
 849 <bgs100>        [Jun 18 22:41:04] Good
 850 <bgs100>        [Jun 18 22:41:09] Anyway 
 851 <seidos>        [Jun 18 22:41:20] after killing it, is memory freed?
 852 <bgs100>        [Jun 18 22:41:28] The point of this was to demonstrate the dangers of m/a/realloc() 
 853 <bgs100>        [Jun 18 22:41:30] seidos, Yes
 854 <bgs100>        [Jun 18 22:41:46] This is known as a "memory leak" 
 855 <seidos>        [Jun 18 22:42:16] hmmm 
 856 <bgs100>        [Jun 18 22:42:18] It is when something is malloc'ed, but forgotten about later in the program, so it just sits around, hogging up your memory. 
 857 <bgs100>        [Jun 18 22:42:29] (or calloc/realloc'd) 
 858 <bgs100>        [Jun 18 22:42:36] I'll just say alloc'd 
 859 <seidos>        [Jun 18 22:42:48] is it possible for memory leaks to exist in some other way? 
 860 <bgs100>        [Jun 18 22:43:05] Yes, most programs don't have memory sucking loops in them 
 861 <bgs100>        [Jun 18 22:43:18] If a variable is assigned to a malloc, 
 862 <bgs100>        [Jun 18 22:43:24] in a non-main function,
 863 <bgs100>        [Jun 18 22:43:35] and that memory is not somehow free'd later,
 864 <bgs100>        [Jun 18 22:43:49] (e.g. the function returned the address and another function free'd it), 
 865 <bgs100>        [Jun 18 22:44:00] it will just be sitting there until the program ends 
 866 <bgs100>        [Jun 18 22:44:45] This was a very extreme example. 
 867 <bgs100>        [Jun 18 22:45:05] Anyway
 868 <bgs100>        [Jun 18 22:45:25] It's 10:41 here; think you've had enough C/Python/Math lesson for the day? 
 869 <seidos>        [Jun 18 22:45:50] I could probably keep going actually 
 870 <bgs100>        [Jun 18 22:45:55] hmm 
 871 <bgs100>        [Jun 18 22:45:57] pedro3005 ? 
 872 <pedro3005>     [Jun 18 22:46:27] bgs100, I'm actually craving sleep, but I'm sure you could continue with seidos 
 873 <seidos>        [Jun 18 22:46:39] it's up to you dude 
 874 <Snova> [Jun 18 22:47:04] seidos: "memory leak" just means allocating something without ever deallocating it 
 875 <Snova> [Jun 18 22:47:14] by accident, that is
 876 <bgs100>        [Jun 18 22:47:18] Lol 
 877 <bgs100>        [Jun 18 22:47:25] pedro3005, Okay, bye 
 878 <bgs100>        [Jun 18 22:47:28] Hm
 879 <bgs100>        [Jun 18 22:47:29] Wait
 880 <bgs100>        [Jun 18 22:47:31] Homework 
 881 <seidos>        [Jun 18 22:47:45] Snova, when I heard "memory leak" I think of a continues leaking of memory, does it have to be continuous to be a "leak"? 
 882 <Snova> [Jun 18 22:47:51] seidos: nah 
 883 <pedro3005>     [Jun 18 22:48:02] Night
 884 <bgs100>        [Jun 18 22:48:08] pedro3005, Wait! 
 885 *       bgs100 [Jun 18 22:48:14] has to think of homework 
 886 <bgs100>        [Jun 18 22:48:33] Hm, I know 
 887 <bgs100>        [Jun 18 22:48:37] pedro3005, seidos
 888 <bgs100>        [Jun 18 22:48:55] I want you to take your program from the previous homework, 
 889 <bgs100>        [Jun 18 22:49:40] and modify it so that you never declare an int; doing it all with int pointers + malloc. 
 890 <seidos>        [Jun 18 22:49:55] Jesus! 
 891 *       bgs100 [Jun 18 22:49:58] will have to think of better homework in advance for tommorow :p 
 892 <bgs100>        [Jun 18 22:50:07] seidos, It's not that bad xP 
 893 <bgs100>        [Jun 18 22:50:32] pedro3005, okay? 
 894 *       bgs100 [Jun 18 22:50:42] hopes pedro3005 isn't gone yet :p 
 895 

learners/18062010 (last edited 2010-06-20 04:25:52 by 117)