17062010
Jun 17 <pedro3005> [16:33:58] juju2143, did I miss it?
Jun 17 <juju2143> [17:09:38] nope
Jun 17 <juju2143> [17:09:58] pedro3005, nope
Jun 17 <pedro3005> [17:10:14] will there be a class today?
Jun 17 <pedro3005> [17:11:28] juju2143, ^
Jun 17 <juju2143> [17:11:45] maybe
Jun 17 <juju2143> [17:11:56] if there is enough ppl
Jun 17 <bgs100> [17:12:11] Hi
Jun 17 * bgs100 [17:12:18] is interested
Jun 17 <bgs100> [17:13:18] Is anyone else around?
Jun 17 <bgs100> [17:13:38] mohi2911 ?
Jun 17 <bgs100> [17:15:31] ...
Jun 17 <pedro3005> [17:15:51] let's call people around
Jun 17 <bgs100> [17:16:03] Ohai pedro3005
Jun 17 * seidos [17:16:15] is here
Jun 17 <bgs100> [17:16:20] Hi
Jun 17 <juju2143> [17:16:27] hi
Jun 17 <juju2143> [17:16:38] tell me if you want to start
Jun 17 <juju2143> [17:16:41] when*
Jun 17 <zkriesse> [17:17:07] lol
Jun 17 <juju2143> [17:17:10] lol
Jun 17 <zkriesse> [17:17:11] another channel?
Jun 17 <zkriesse> [17:17:16] Who made this one?
Jun 17 <pedro3005> [17:17:20] mohi2911
Jun 17 <zkriesse> [17:17:24] figures
Jun 17 <zkriesse> [17:17:32] mohi2911: does a lot of channel making
Jun 17 <bgs100> [17:22:58] juju2143, /me is ready.
Jun 17 <bgs100> [17:23:07] pedro3005, seidos ?
Jun 17 * seidos [17:23:41] is ready
Jun 17 <pedro3005> [17:23:58] sure, go ahead
Jun 17 * bgs100 [17:24:01] initiates learning power thormal drive
Jun 17 <juju2143> [17:24:07] ok
Jun 17 <juju2143> [17:24:23] Welcome to C# course by juju2143.
Jun 17 <bgs100> [17:24:39] Yay
Jun 17 * seidos [17:24:44] claps
Jun 17 <juju2143> [17:25:01] Today, history of C# and your first program.
Jun 17 <juju2143> [17:25:47] 1st lesson: What is C#
Jun 17 <juju2143> [17:26:41] C# is a OOP language invented by Microsoft, with a free implementation by Novell
Jun 17 <bgs100> [17:27:16] Mono?
Jun 17 <juju2143> [17:27:25] yep, Mono
Jun 17 <seidos> [17:27:31] what is mono?
Jun 17 <juju2143> [17:27:47] I won't take my time telling everything, just check wikipedia.
Jun 17 <juju2143> [17:28:10] Mono is the free implementation of the .NET Framework
Jun 17 <juju2143> [17:28:35] so it makes the language multi-plateform and multi-OS
Jun 17 <juju2143> [17:28:48] much like Java.
Jun 17 <juju2143> [17:30:00] So C# is perfect to make your app working on everything.
Jun 17 <juju2143> [17:30:15] Anyone is on Windows here?
Jun 17 <bgs100> [17:30:30] I'm not
Jun 17 <juju2143> [17:30:40] Good
Jun 17 <seidos> [17:31:20] does mono work on all platforms equally well?
Jun 17 <juju2143> [17:31:33] seidos, yes
Jun 17 <pedro3005> [17:31:48] doesn't C work on all platforms?
Jun 17 <bgs100> [17:32:06] pedro3005, Yes, but you have to recompile and there are compiler differences.
Jun 17 <juju2143> [17:32:15] pedro3005, yes but you have to compile it to every platform
Jun 17 <juju2143> [17:32:18] yeah
Jun 17 <pedro3005> [17:32:28] ok, I see
Jun 17 <pedro3005> [17:32:28] go on
Jun 17 <seidos> [17:32:30] I thought C# was different than C
Jun 17 <bgs100> [17:32:50] It is, pedro3005 was just asking about C also.
Jun 17 <pedro3005> [17:32:52] it is
Jun 17 <juju2143> [17:33:00] so with Mono you have the same .exe working everywhere, with a language like C or Java
Jun 17 <seidos> [17:33:06] ah, I see now
Jun 17 <seidos> [17:34:03] I'm confused again, you compile a .exe one time, and that binary will work on both windows and GNU/Linux?
Jun 17 <juju2143> [17:34:25] seidos, yes.
Jun 17 <pedro3005> [17:34:40] sounds good
Jun 17 <seidos> [17:34:45] wow
Jun 17 <juju2143> [17:35:19] Unlike Java, the app is seamlessly integrated with windows
Jun 17 <juju2143> [17:35:31] it's what makes its force.
Jun 17 <juju2143> [17:35:46] Personally, it's my favorite language
Jun 17 <bgs100> [17:36:06] Once I made a .jar (Java Archive) that worked fine here but then said it couldn't find the main class on windows :/
Jun 17 <bgs100> [17:36:17] Anyway
Jun 17 <juju2143> [17:36:25] yeah...
Jun 17 <juju2143> [17:36:58] Things like that could happen, but it's like you are missing a .dll.
Jun 17 <juju2143> [17:37:42] So for developping, any text editor with syntaxing coloration will work.
Jun 17 <juju2143> [17:38:33] But I would recommand you MonoDevelop (for Linux and Windows) or Microsoft Visual Studio (for Windows).
Jun 17 <juju2143> [17:40:03] And, of course, you need mono. They are easily findable in your package manager.
Jun 17 * bgs100 [17:40:07] installs MonoDevelop (package monodevelop in Ubuntu)
Jun 17 <juju2143> [17:40:27] I'll go do something while you are downloading them.
Jun 17 <seidos> [17:41:33] is monodevelop the only package I have to install?
Jun 17 <bgs100> [17:42:37] monodevelop seems to depend on mono.
Jun 17 <seidos> [17:43:26] k cool, so it'll get installed automatically
Jun 17 <seidos> [17:43:29] I have another question
Jun 17 <seidos> [17:43:39] it seems a lot of software development is going to start moving to web apps
Jun 17 <seidos> [17:43:46] can you develop web applications with C#?
Jun 17 * bgs100 [17:44:07] pings juju2143 on seidos's behalf
Jun 17 <juju2143> [17:44:12] seidos, yes
Jun 17 <seidos> [17:44:38] it seems like most mainstream languages can work for web apps
Jun 17 <juju2143> [17:45:01] IIS servers lets you use C# as part of their aspx thing
Jun 17 <juju2143> [17:45:26] There is also a plugin in apache to use mono
Jun 17 <bgs100> [17:46:50] Cool
Jun 17 <juju2143> [17:47:04] But I never figured out how to use it...
Jun 17 <seidos> [17:47:17] I don't have a webserver anyway
Jun 17 <seidos> [17:47:26] unless i ran it on my laptop
Jun 17 <seidos> [17:47:37] worse, I don't have an idea or the skill to develop a web app :P
Jun 17 <juju2143> [17:48:42] yeah, you are better to develop your web app with PHP.
Jun 17 <juju2143> [17:48:58] So you have downloaded MonoDevelop.
Jun 17 <bgs100> [17:49:34] Yep
Jun 17 <juju2143> [17:49:39] right? tell me if so.
Jun 17 <bgs100> [17:49:43] It's running right now
Jun 17 <juju2143> [17:49:47] ok
Jun 17 <bgs100> [17:49:49] seidos, pedro3005 ?
Jun 17 <pedro3005> [17:49:57] hey
Jun 17 <pedro3005> [17:50:34] It's installing, you can stat
Jun 17 <pedro3005> [17:50:37] start
Jun 17 <seidos> [17:50:48] i'm installed
Jun 17 <juju2143> [17:50:48] ok
Jun 17 <juju2143> [17:51:05] Now start a new solution
Jun 17 <seidos> [17:51:14] and running
Jun 17 <juju2143> [17:51:17] ok
Jun 17 <bgs100> [17:51:28] What kind?
Jun 17 <juju2143> [17:51:33] Start a new console project in C#
Jun 17 <juju2143> [17:51:54] give your solution a name
Jun 17 <seidos> [17:52:00] under C# I have ASP.NET, General, Gtk, Misc
Jun 17 <juju2143> [17:52:14] Click on C#
Jun 17 <juju2143> [17:52:21] directly
Jun 17 <seidos> [17:52:22] nevermind
Jun 17 <seidos> [17:52:27] I did new file, not new solution
Jun 17 <seidos> [17:52:28] sorry
Jun 17 <juju2143> [17:52:32] oh
Jun 17 <juju2143> [17:53:07] So first lesson, your projects are arranged as solutions
Jun 17 <seidos> [17:53:23] juju2143, should I check any of the "project features" packaging, GTK# support, etc?
Jun 17 <juju2143> [17:53:43] A solution can be composed of more than one project
Jun 17 <juju2143> [17:53:53] hm, no features as of now.
Jun 17 <seidos> [17:53:53] nm, that was a stupid question, it's obviously no
Jun 17 <bgs100> [17:54:41] Eh, it might not have been.
Jun 17 <bgs100> [17:54:44] anyway
Jun 17 <juju2143> [17:54:56] So in front of your eyes, you have a sample file.
Jun 17 <bgs100> [17:55:06] Yep
Jun 17 <juju2143> [17:55:19] You will recognize the famous Hello World! text
Jun 17 <bgs100> [17:55:26] Also yep
Jun 17 <pedro3005> [17:55:33] console project, empty project, gtk, what?
Jun 17 <juju2143> [17:55:33] Compile it and execute it
Jun 17 <bgs100> [17:55:39] pedro3005, Console
Jun 17 <juju2143> [17:55:44] pedro3005, console project
Jun 17 * bgs100 [17:56:13] looks around for run button
Jun 17 <bgs100> [17:56:24] Oh
Jun 17 <pedro3005> [17:56:25] F5
Jun 17 <bgs100> [17:56:27] There it is
Jun 17 <pedro3005> [17:56:28] It runs
Jun 17 <juju2143> [17:56:30] Ctrl-F5
Jun 17 <bgs100> [17:56:38] Yay
Jun 17 <juju2143> [17:56:41] So you will see... Hello World.
Jun 17 <bgs100> [17:56:54] *nods*
Jun 17 <juju2143> [17:57:06] Wonderful, isn't it?
Jun 17 <juju2143> [17:57:20] Let's analyse the Main.cs file togheter.
Jun 17 <juju2143> [17:57:53] Obviously, Main.cs contains the first function to be executed, Main().
Jun 17 <juju2143> [17:58:14] Line 1, you have "using System;"
Jun 17 <juju2143> [17:59:17] Tells the compiler to link the System library, which contains all the essential functions used in your project.
Jun 17 <pedro3005> [17:59:42] namely Console.writeline?
Jun 17 <juju2143> [17:59:46] Yep
Jun 17 <juju2143> [17:59:57] Console.WriteLine is part of System
Jun 17 <pedro3005> [18:00:04] alright
Jun 17 <juju2143> [18:00:30] line 3, you have a namespace
Jun 17 <juju2143> [18:01:00] in yoour namespace you have a class
Jun 17 <juju2143> [18:01:13] and in your class you have a function.
Jun 17 <juju2143> [18:01:36] This hierarchi is actually OOP.
Jun 17 <juju2143> [18:02:01] Now let's analyse Console.WriteLine.
Jun 17 <seidos> [18:02:13] so a namespace, class, and function are "objects"?
Jun 17 <juju2143> [18:02:23] yes.
Jun 17 <juju2143> [18:02:33] So, WriteLine is a function in the Console class
Jun 17 <juju2143> [18:02:45] which is in the System namespace
Jun 17 <pedro3005> [18:03:23] what is a namespace?
Jun 17 <bgs100> [18:03:27] So does "using" bring in the things in a namespace?
Jun 17 <juju2143> [18:03:32] so the using System; line is used to tell the compiler we will use the System namespace by defauld
Jun 17 <juju2143> [18:03:37] default
Jun 17 <juju2143> [18:03:56] so we won't write System.Console.WriteLine
Jun 17 <juju2143> [18:04:20] It's handy.
Jun 17 <juju2143> [18:04:34] Of course, you can have more than one namespace
Jun 17 <pedro3005> [18:04:43] I don't understand line 7
Jun 17 <juju2143> [18:05:02] Line 7... It's the next thing I'll talk of.
Jun 17 <juju2143> [18:05:42] so you see Main, which is the name of the function
Jun 17 <juju2143> [18:06:02] since we are in a class, the function is actually a method.
Jun 17 <juju2143> [18:06:48] your functions, as usual, will have parameters, Main(string[] args)
Jun 17 <pedro3005> [18:07:08] why "string[] args"?
Jun 17 <juju2143> [18:07:09] So you will see that the variables are strongly typed.
Jun 17 <juju2143> [18:07:23] args is an array of strings.
Jun 17 <seidos> [18:07:51] I don't understand why it has parameters
Jun 17 <pedro3005> [18:07:53] and first, why is Main receiving arguments? what is it receiving from?
Jun 17 <juju2143> [18:07:58] so you have the type, string, [] who tells your variable is an array
Jun 17 <seidos> [18:08:06] all it's doing is writing out "hello world" why would it need any parameters?
Jun 17 <juju2143> [18:08:14] and args is the arguments to your programs
Jun 17 <juju2143> [18:08:35] Like in C you would do main(argc, argv)
Jun 17 <bgs100> [18:08:37] pedro3005, It's like C's main; it can be passed the array of command line arguments.
Jun 17 <pedro3005> [18:09:14] I normally just do main()
Jun 17 <juju2143> [18:09:14] But in this case we have only one variable, argc is actually args.Length
Jun 17 <seidos> [18:09:30] when I take out the parameters from main it still compiles okay it seems
Jun 17 <juju2143> [18:09:39] Main() is perfectly acceptable
Jun 17 <bgs100> [18:09:57] pedro3005, Yes, but you can take the command-line arguments if you need them\
Jun 17 <juju2143> [18:09:59] Take out the args and it compiles
Jun 17 <juju2143> [18:10:09] brb, moms calling me.
Jun 17 <seidos> [18:10:19] but that makes me wonder why it compiles with parameters that appear not to be used
Jun 17 <bgs100> [18:12:42] seidos, I imagine it might generate a warning, but not an error.
Jun 17 <seidos> [18:12:57] yeah, that's what I was thinking
Jun 17 <seidos> [18:13:05] maybe there was a warning but didn't see it
Jun 17 <juju2143> [18:13:11] back
Jun 17 <juju2143> [18:13:24] There is no warning.
Jun 17 <seidos> [18:13:37] 0 errors and 0 warnings
Jun 17 <juju2143> [18:13:45] Yep.
Jun 17 <seidos> [18:13:49] I guess it doesn't really matter, I can't think of why it would be a warning
Jun 17 <bgs100> [18:13:59] Is there something like C's -Wall?
Jun 17 <bgs100> [18:14:02] er
Jun 17 <pedro3005> [18:14:03] I see, I just don't exactly understand why string[] args
Jun 17 <bgs100> [18:14:04] gcc's*
Jun 17 <seidos> [18:14:09] can I put anything I want into Main()
Jun 17 <juju2143> [18:14:17] Yeah, unused variables don't change anything in your program.
Jun 17 <juju2143> [18:14:57] bgs100, yes, I think, the compiler is actually part of GCC
Jun 17 <juju2143> [18:15:04] or sth
Jun 17 <seidos> [18:15:15] if I add blah to main() so it reads Main(string[] args blah) I get an error
Jun 17 <pedro3005> [18:15:24] well obviously
Jun 17 <bgs100> [18:15:31] pedro3005, I imagine that it's like C; [] denotes an array of an object, string is the object, and args is the variable name
Jun 17 <bgs100> [18:15:53] The command-line arguments being a list of strings.
Jun 17 <pedro3005> [18:15:55] so it's like int args but only string[] args?
Jun 17 <bgs100> [18:16:16] As far as I understand (/me is kind of playing teacher here :P)
Jun 17 <juju2143> [18:16:23] yeah
Jun 17 <seidos> [18:16:29] pedro3005, well why? string[] and args aren't doing anything either
Jun 17 <seidos> [18:16:40] why does the compiler hate my blah?
Jun 17 <pedro3005> [18:16:57] seidos, because string[] and args are not two variables
Jun 17 <pedro3005> [18:16:58] just one
Jun 17 <juju2143> [18:17:01] of course, but if in comand line you do ./test.exe some arg well see it
Jun 17 <pedro3005> [18:17:01] args
Jun 17 <juju2143> [18:17:17] yeah, it's strongly typed
Jun 17 <pedro3005> [18:17:22] Console.WriteLine(args);
Jun 17 <pedro3005> [18:17:25] I get
Jun 17 <pedro3005> [18:17:30] System.String[]
Jun 17 <juju2143> [18:17:32] You have to use Main(strings[] args, int blah)
Jun 17 <juju2143> [18:17:56] pedro3005, you have to do a for loop
Jun 17 <bgs100> [18:18:10] If you wanted to print each arg?
Jun 17 <juju2143> [18:18:13] We will try this.
Jun 17 <juju2143> [18:18:34] for(int i=0; i<args.Length; i++)
Jun 17 <juju2143> [18:18:45] Console.WriteLine(args[i]);
Jun 17 <seidos> [18:18:48] so string[] args is one parameter, so how do I add another one, string[] blah or int blah?
Jun 17 <juju2143> [18:19:01] Main(strings[] args, int blah)
Jun 17 <juju2143> [18:19:29] but it's useless, all the parameters are stored in a list in args
Jun 17 <seidos> [18:19:57] putting this: Main(string[] args, int blah) gave me an error
Jun 17 <seidos> [18:20:35] args is a system var?
Jun 17 <pedro3005> [18:20:53] it outputs... nothing
Jun 17 <juju2143> [18:21:09] Yes, Main have to have 0 or 1 argument to be executed
Jun 17 <juju2143> [18:21:26] Main with 2 arguments is a completly different function
Jun 17 <pedro3005> [18:21:31] how do I feed some argument to it?
Jun 17 <juju2143> [18:21:41] pedro3005, go in command line
Jun 17 <bgs100> [18:22:00] juju2143, What about Run -> Run With -> Custom Parameters?
Jun 17 <seidos> [18:22:01] where is the binary located?
Jun 17 <bgs100> [18:22:10] Would that work?
Jun 17 <juju2143> [18:22:11] bgs100, yes!
Jun 17 <juju2143> [18:22:14] I twould
Jun 17 <bgs100> [18:22:15]
Jun 17 <juju2143> [18:22:44] seidos, it's usually located in ~/Projects/name of solution/name of project/bin/Debug
Jun 17 <bgs100> [18:22:49] Yay it worked
Jun 17 <juju2143> [18:22:49] cd there
Jun 17 <pedro3005> [18:22:53] bgs100, mine doesn't have that!
Jun 17 <pedro3005> [18:22:57]
Jun 17 <bgs100> [18:22:57] pedro3005, 0_o
Jun 17 <bgs100> [18:23:08] pedro3005, Run on the top menubar?
Jun 17 <pedro3005> [18:23:15] yeah
Jun 17 <bgs100> [18:23:21] Do you have that?
Jun 17 <juju2143> [18:23:23] yeah
Jun 17 <pedro3005> [18:23:24] which version is yours?
Jun 17 <bgs100> [18:23:35] 2.2.1
Jun 17 <pedro3005> [18:23:40] mine is 2.0
Jun 17 <seidos> [18:23:46] mine is 2.0 too
Jun 17 <bgs100> [18:23:46] ...
Jun 17 <seidos> [18:23:53] don't have run with
Jun 17 <pedro3005> [18:23:55] freaking ubuntu apt-get
Jun 17 <juju2143> [18:23:59] pedro3005, what version of Ubuntu you have?
Jun 17 <bgs100> [18:24:00] pedro3005,
Jun 17 <bgs100> [18:24:04] I used apt-get too
Jun 17 <pedro3005> [18:24:05] juju2143, 9.10
Jun 17 <bgs100> [18:24:09] Ah
Jun 17 <juju2143> [18:24:11] Obviously not Lucid
Jun 17 * bgs100 [18:24:12] has 10.04
Jun 17 <juju2143> [18:24:14] yeah
Jun 17 <seidos> [18:24:16] I did apt-get monodevelop
Jun 17 * juju2143 [18:24:17] too
Jun 17 <bgs100> [18:24:17] juju2143, That is lucid
Jun 17 <pedro3005> [18:24:19] too lazy to Lucid
Jun 17 <bgs100> [18:24:29] ERrrrrrrr
Jun 17 <bgs100> [18:24:32] Sorry
Jun 17 <bgs100> [18:24:33] My bad
Jun 17 <juju2143> [18:24:34] 9.10 is Karmic
Jun 17 <bgs100> [18:24:39] K is before 'L' xP
Jun 17 <juju2143> [18:24:43] Lol.
Jun 17 <seidos> [18:24:43] don't even ask what version of Ubuntu I'm running
Jun 17 * bgs100 [18:24:58] is now tempted to ask
Jun 17 <pedro3005> [18:24:59] 8.04?
Jun 17 <juju2143> [18:25:00] bgs100, learn your alphabet and come back when you did
Jun 17 <seidos> [18:25:05] Lucid Beta messed up my system, so I'm running on a hybrid MoonOS with ubuntu-desktop installed
Jun 17 <bgs100> [18:25:05]
Jun 17 <bgs100> [18:25:10] I know my alphabet!
Jun 17 <juju2143> [18:25:15] j/k lol.
Jun 17 <seidos> [18:25:18] :'(
Jun 17 <juju2143> [18:25:28] just messing with ya.
Jun 17 <pedro3005> [18:25:29] juju2143, well, you need to explain 'static' and 'void'
Jun 17 <juju2143> [18:25:33] seidos, Lolwut.
Jun 17 <bgs100> [18:25:37] acdbefgihjlknmoprqtsuvxwyz
Jun 17 <bgs100> [18:25:42] See!?
Jun 17 <juju2143> [18:25:55] Yep. public static void.
Jun 17 <seidos> [18:25:57] bgs100, now do it backwards!
Jun 17 <juju2143> [18:26:15] my alphabet is qwertyuiopasdfghjklzxcvbnm
Jun 17 <bgs100> [18:26:25] zywxvustqrpomnkljhigfebdca
Jun 17 * seidos [18:26:41] stares at bgs100 in amazement
Jun 17 <juju2143> [18:27:12] So, void indicates the type of the return
Jun 17 <pedro3005> [18:27:13] print string.ascii_lowercase
Jun 17 <bgs100> [18:27:41] pedro3005, !!!
Jun 17 <bgs100> [18:27:51] This is a C# class, not Python!
Jun 17 <juju2143> [18:27:56] Yeah.
Jun 17 <juju2143> [18:28:03] Calm down guys.
Jun 17 <pedro3005> [18:28:03] :P that's my alphabet
Jun 17 <juju2143> [18:28:10] I'll continue
Jun 17 <pedro3005> [18:28:14] go on
Jun 17 <juju2143> [18:28:21] So, void indicates the type of the return
Jun 17 <pedro3005> [18:28:31] which is nothing?
Jun 17 <juju2143> [18:28:35] Yes.
Jun 17 <juju2143> [18:28:47] Try to change void by int
Jun 17 <seidos> [18:28:49] return is different than output?
Jun 17 <pedro3005> [18:28:54] shouldn't it return 0?
Jun 17 <juju2143> [18:28:55] yes
Jun 17 <juju2143> [18:29:01] and return 0;
Jun 17 <juju2143> [18:29:09] add return 0; at the end
Jun 17 <seidos> [18:29:27] is monodevelop an IDE?
Jun 17 <juju2143> [18:29:35] pedro3005, if you write void, by dfault it's 0
Jun 17 <juju2143> [18:29:42] seidos, of course it is
Jun 17 <pedro3005> [18:29:42] Oh I see
Jun 17 <juju2143> [18:30:16] So your application should exit by returning 0
Jun 17 <seidos> [18:30:24] cool, now I can say "I've used a C# IDE"
Jun 17 <juju2143> [18:30:31] hehe
Jun 17 <pedro3005> [18:30:58] ok, let's go on... static means?
Jun 17 <seidos> [18:31:01] it's much nicer than python, like how you type int and it gives you a list of possibilites
Jun 17 <bgs100> [18:31:15] seidos, Language != IDE
Jun 17 <pedro3005> [18:31:16] seidos, just download a Python IDE
Jun 17 <seidos> [18:31:38] there's a python IDE?
Jun 17 <pedro3005> [18:31:44] probably
Jun 17 <bgs100> [18:31:45] There's many
Jun 17 <bgs100> [18:32:01] There's even something of a standard one; Python's IDLE
Jun 17 <pedro3005> [18:32:03] but this is a C# class
Jun 17 <bgs100> [18:32:04] Anyway
Jun 17 <bgs100> [18:32:07] Yeah
Jun 17 <seidos> [18:32:08] hmmm that would probably help my inability to recall commands a bit
Jun 17 <juju2143> [18:32:12] static is that you don't have to put your class in a new object to invoke Main
Jun 17 <seidos> [18:32:12] sorry
Jun 17 <juju2143> [18:32:35] We will se that with the new operator
Jun 17 <pedro3005> [18:32:45] oh, I think I know what you mean
Jun 17 <juju2143> [18:32:50] Like WriteLine is static
Jun 17 <pedro3005> [18:32:55] so you do not need to instanciate Main to invoke it?
Jun 17 <seidos> [18:32:58] I'll have to think on it to hopefully understand
Jun 17 <juju2143> [18:33:05] you dont have to do Console something = new console
Jun 17 <juju2143> [18:33:16] pedro3005, yep
Jun 17 <pedro3005> [18:33:24] Yeah, I see it
Jun 17 <pedro3005> [18:33:25] okay
Jun 17 <seidos> [18:34:40] but isn't the class in a "new object" the object namespace "FirstSolution"?
Jun 17 <juju2143> [18:34:47] and public, Main is visible in your instance, unlike private, who will make your function only accessible inside your class
Jun 17 <juju2143> [18:35:21] Namespaces is only related with the using instruction.
Jun 17 <seidos> [18:35:49] so it can't be said the class is inside the object namespace?
Jun 17 <juju2143> [18:36:06] it does
Jun 17 <juju2143> [18:36:23] Classes is in namespaces.
Jun 17 <juju2143> [18:36:26] etc.
Jun 17 <juju2143> [18:36:39] Any other questions?
Jun 17 <seidos> [18:36:49] but you said static is so that you don't have to put your class in another object before you call main
Jun 17 <seidos> [18:36:55] but isn't the class already in an object?
Jun 17 <juju2143> [18:37:11] yeah, everything is object
Jun 17 <seidos> [18:37:35] I'm obviously missing something, because static is required for compilation
Jun 17 <juju2143> [18:38:18] yeah, that's because the compiler don't instanciate the class before using it
Jun 17 <seidos> [18:38:29] can you give an example of a program where static isn't needed while still calling main?
Jun 17 <juju2143> [18:38:41] Of course.
Jun 17 <seidos> [18:39:18] I don't get the compiler stuff, but maybe if I think some more it will make more sense
Jun 17 <juju2143> [18:39:20] Just create a new function like Main
Jun 17 <juju2143> [18:39:26] and call it in Main
Jun 17 <bgs100> [18:39:41] seidos, Everything is an object, including classes but whereas you have to make an new object *from* a class to use non-static methods, static methods do not rely on non-static data from a class and can be called without making an instance of a class.
Jun 17 <juju2143> [18:39:55] brb, i'll take my notes for the next part of the course.
Jun 17 <juju2143> [18:40:51] K, found them.
Jun 17 <seidos> [18:41:26] bgs100, I read what you wrote three times, still don't really get it
Jun 17 <juju2143> [18:41:43] yeah, OOP is hard to get sometimes.
Jun 17 <juju2143> [18:42:09] Just ignore static for now and we'll talk of that in the right chapter.
Jun 17 <juju2143> [18:43:08] Create another solution, a GTK+ one now.
Jun 17 <juju2143> [18:43:24] GTK#
Jun 17 <juju2143> [18:43:25] *
Jun 17 <pedro3005> [18:44:38] done
Jun 17 <seidos> [18:44:45] done
Jun 17 <juju2143> [18:45:02] brb
Jun 17 <bgs100> [18:45:22] I got an error
Jun 17 <bgs100> [18:45:51] ....it seemed to work anyway
Jun 17 <pedro3005> [18:46:05] (/home/pedro/Projects/Gtk First/Gtk First/bin/Debug/Gtk First.exe:4593): GLib-WARNING **: g_set_prgname() called multiple times
Jun 17 <juju2143> [18:47:53] hmmm
Jun 17 <juju2143> [18:48:24] Yeah, seems that nothing is working right.
Jun 17 <juju2143> [18:49:04] You have somes minutes pause while i find a workaround
Jun 17 <seidos> [18:50:03] it worked okay for me it looks like
Jun 17 <pedro3005> [18:50:06] alright, quick run to the store
Jun 17 <pedro3005> [18:50:07] brb
Jun 17 <seidos> [18:50:11] no errors and I was able to compile
Jun 17 <juju2143> [18:51:16] ok
Jun 17 <juju2143> [18:51:29] seems you have to install gtk-sharp2
Jun 17 <juju2143> [18:51:39] apt-get install gtk-sharp2
Jun 17 <juju2143> [18:52:55] The course will resume when pedro3005 willl be back.
Jun 17 <bgs100> [18:53:59] 0_0
Jun 17 <bgs100> [18:54:07] back
Jun 17 <bgs100> [18:54:15] I got warnings/errors too
Jun 17 <juju2143> [18:54:44] bgs100, apt-get install gtk-sharp2 then restart MonoDevelop
Jun 17 <bgs100> [18:55:37] okay
Jun 17 * seidos [18:56:08] checks to see if he already has gtk-sharp2
Jun 17 <seidos> [18:56:27] nope
Jun 17 <seidos> [18:56:34] maybe I should install it anyway
Jun 17 <juju2143> [18:57:05] yeah
Jun 17 <bgs100> [18:58:22] Er
Jun 17 <bgs100> [18:58:32] How do I re-open the solution
Jun 17 <bgs100> [18:58:33] ?
Jun 17 <bgs100> [18:58:55] oh
Jun 17 <bgs100> [18:58:56] nvm
Jun 17 <bgs100> [18:59:10] Yay it worked
Jun 17 <juju2143> [19:01:39] yay.
Jun 17 <juju2143> [19:02:06] omg 23 UTC.
Jun 17 <bgs100> [19:02:09] I'm supposed to start a C class in a few minutes, btw.
Jun 17 <bgs100> [19:02:11] Yeah
Jun 17 <juju2143> [19:02:20] End of lesson 1.
Jun 17 <juju2143> [19:02:27] on hello worlds.
Jun 17 <bgs100> [19:03:24] juju2143, Thanks for teaching, /me enjoyed the lesson
Jun 17 <seidos> [19:03:39] thank you juju2143
Jun 17 <seidos> [19:03:56] C# is cool, what isn't cool is my lack of ability in programming in it
Jun 17 <juju2143> [19:03:58] yw
Jun 17 <seidos> [19:04:16] so what projects are you currently working on?
Jun 17 <juju2143> [19:04:19] seidos, yeah, well see that tomorrow, we'll begin GTK#
Jun 17 <seidos> [19:04:26] all right
Jun 17 <juju2143> [19:04:38] it will become interesting
Jun 17 <bgs100> [19:04:38] Anyway
Jun 17 <juju2143> [19:04:47] seidos, made a bot in C#
Jun 17 <seidos> [19:04:55] neat
Jun 17 <bgs100> [19:05:01] Who will be participating in the C class?
Jun 17 <juju2143> [19:05:01] yeah
Jun 17 <juju2143> [19:05:06] maybe me
Jun 17 <seidos> [19:05:09] do you guys think that ubuntu will go the way that chromium has gone?
Jun 17 <bgs100> [19:05:11] Cool
Jun 17 <seidos> [19:05:20] I should probably ask in ubuntu-offtopic
Jun 17 <bgs100> [19:05:44] pedro3005 suggested that I do it (when I mentioned 3 I might be interested in doing) so I expect him to be
Jun 17 <bgs100> [19:06:04] hm, installing kubuntu-desktop changed a lot of defaults >:|
Jun 17 <pedro3005> [19:07:02] back
Jun 17 <bgs100> [19:07:12] pedro3005, About to start the C class
Jun 17 <bgs100> [19:07:23] seidos, Will you be participating?
Jun 17 <seidos> [19:07:42] yeah, as much as I can
Jun 17 <seidos> [19:07:46] I have to eat lunch soon though
Jun 17 <bgs100> [19:08:13] Okay
Jun 17 <bgs100> [19:08:32] Is everyone (all 3 of you :p) ready to begin?
Jun 17 <juju2143> [19:08:33] me too
Jun 17 <seidos> [19:08:40] thanks for the invite
Jun 17 <juju2143> [19:08:42] yeah
Jun 17 <bgs100> [19:09:12] seidos, np, heh
Jun 17 <bgs100> [19:09:17] Okay
Jun 17 <bgs100> [19:09:19] pedro3005, ?
Jun 17 <pedro3005> [19:09:28] juju2143, btw thanks for the class and initiative
Jun 17 <bgs100> [19:09:41] pedro3005, ready?
Jun 17 <pedro3005> [19:09:44] yes
Jun 17 <bgs100> [19:09:47] Cool
Jun 17 <bgs100> [19:09:52] We'll start then
Jun 17 <bgs100> [19:10:07]
May ze C Class Begin!
Jun 17 <bgs100> [19:10:10] Okay
Jun 17 <bgs100> [19:10:23] So, first a little background information
Jun 17 <juju2143> [19:11:50] k
Jun 17 <bgs100> [19:11:54] C is a compiled language. This means that you have the code as files, then you run the compiler on them, and it makes a binary, executable file which is, well, executable.
Jun 17 <juju2143> [19:11:54] pedro3005, yw
Jun 17 <bgs100> [19:12:18] Since you all seem to be on Linux, we will be using gcc.
Jun 17 <pedro3005> [19:12:41] Yeah, I think most of us have some minimal experience with C
Jun 17 <bgs100> [19:13:06] C is not Object Oriented, although you can do a fair bit of what object orientation is with structs and functions.
Jun 17 <bgs100> [19:13:20] pedro3005, Ah. Well, I'll do background info anyway :p
Jun 17 <pedro3005> [19:13:33] bgs100, so it is event oriented?
Jun 17 <bgs100> [19:13:44] It's procedural.
Jun 17 <bgs100> [19:14:38] This means it has procedures/functions, and executes code in a 'normal' order.
Jun 17 <pedro3005> [19:14:58] Ok, I see
Jun 17 <juju2143> [19:15:16] ok.
Jun 17 <bgs100> [19:15:21] I don't care what text editor or IDE you use, as long as you can edit and save. I'll be assuming compilation via the command line, and give the commands.
Jun 17 <bgs100> [19:15:27] pedro3005, Okay
Jun 17 <bgs100> [19:15:39] I will be using gedit and/or vim.
Jun 17 <juju2143> [19:15:54] vim ...
Jun 17 <bgs100> [19:16:02] juju2143, ?
Jun 17 <pedro3005> [19:16:02] gedit ftw :p
Jun 17 <juju2143> [19:16:08] nothing
Jun 17 <juju2143> [19:16:12] emacs ftw
Jun 17 <bgs100> [19:16:18] Lol, I use emacs too
Jun 17 <bgs100> [19:16:24] For Common Lisp coding
Jun 17 <bgs100> [19:16:45] I just generally use vim for a quick edit in the terminal.
Jun 17 <bgs100> [19:16:47] ANYWAY
Jun 17 <juju2143> [19:17:01] nano lol. and ANYWAY.
Jun 17 <bgs100> [19:17:08] Lol
Jun 17 <bgs100> [19:17:10] So yeah, open up your favorite editor and a terminal.
Jun 17 * bgs100 [19:17:20] patiently waits
Jun 17 <bgs100> [19:17:47] You might want to make a folder for this class
Jun 17 <pedro3005> [19:17:48] ok, got it
Jun 17 <bgs100> [19:17:54] juju2143, seidos ?
Jun 17 <seidos> [19:18:01] sorry catching up
Jun 17 <bgs100> [19:18:07] Okay
Jun 17 <pedro3005> [19:18:10] damn I need to clean up my /home
Jun 17 <bgs100> [19:18:15] Tell me when you're ready
Jun 17 <juju2143> [19:18:32] ok
Jun 17 <seidos> [19:18:42] okay
Jun 17 <bgs100> [19:18:47] Cool then.
Jun 17 <seidos> [19:19:06] ah a folder for this "class" as in classroom, I thought you were talking about classes
Jun 17 <bgs100> [19:19:12] :p
Jun 17 <bgs100> [19:19:12] Also
Jun 17 <seidos> [19:19:15] are there classes in c?
Jun 17 <bgs100> [19:19:40] Would you prefer for me to pastebin the code to write or say it here line by line?
Jun 17 <bgs100> [19:20:04] pedro3005, Also, no swearing in class! Report to my office after class, please.
Jun 17 <bgs100> [19:20:06] (jk)
Jun 17 <juju2143> [19:20:10] lol.
Jun 17 <pedro3005> [19:20:17] bgs100, "damn" is swearing?
Jun 17 <pedro3005> [19:20:27] seidos, these ARE about C
Jun 17 <bgs100> [19:20:31] Yes :p
Jun 17 <bgs100> [19:20:35] ANYWAY
Jun 17 <bgs100> [19:20:43] I'll just say what to write line by line
Jun 17 <juju2143> [19:20:46] ok
Jun 17 <bgs100> [19:20:51] Okay, on the first line, type/copy:
Jun 17 <bgs100> [19:20:57] #include <stdio.h>
Jun 17 <bgs100> [19:21:40] Skip a line, and type:
Jun 17 <bgs100> [19:21:45] int main() {
Jun 17 <bgs100> [19:22:18] Then:
Jun 17 <bgs100> [19:22:41] printf("Hello, solar system!\n");
Jun 17 <bgs100> [19:22:50] Next:
Jun 17 <bgs100> [19:22:53] return 0;
Jun 17 * pedro3005 [19:22:54] raises hand
Jun 17 <bgs100> [19:22:57] Finally:
Jun 17 <bgs100> [19:22:58] }
Jun 17 <bgs100> [19:23:01] pedro3005, Yes?
Jun 17 <pedro3005> [19:23:14] bgs100, is it int main() or just main()?
Jun 17 <bgs100> [19:23:21] int main() {
Jun 17 <pedro3005> [19:23:45] bgs100, yeah, 'cause I have this book about C and they just use main() without int
Jun 17 <pedro3005> [19:24:18] it's C by Ritchie and Kerninghan
Jun 17 <bgs100> [19:24:40] It's probably the first edition; pre-ANSI C defaulted to int for functions without warnings or errors.
Jun 17 <pedro3005> [19:25:00] ok
Jun 17 <bgs100> [19:25:06] Anyway
Jun 17 <bgs100> [19:25:34] Well, The second edition says "main()" too but they start using int later.
Jun 17 <bgs100> [19:25:40] ANYWAY
Jun 17 <bgs100> [19:26:02] So what you have should look like this:
Jun 17 <bgs100> [19:26:07] #include <stdio.h>
Jun 17 <bgs100> [19:26:07]
Jun 17 <bgs100> [19:26:08] int main() {
Jun 17 <bgs100> [19:26:08] printf("Hello, solar system!\n");
Jun 17 <bgs100> [19:26:08] return 0;
Jun 17 <bgs100> [19:26:09] }
Jun 17 <bgs100> [19:26:14] Everyone good?
Jun 17 <pedro3005> [19:26:18] good
Jun 17 <bgs100> [19:26:23] Cool
Jun 17 <seidos> [19:26:28] affirmative
Jun 17 <bgs100> [19:26:38] Cool
Jun 17 <bgs100> [19:26:42] (again)
Jun 17 <bgs100> [19:26:55] Save this file as main.c , 01.c or something like that
Jun 17 <juju2143> [19:27:10] k
Jun 17 <bgs100> [19:27:35] Now, go to your terminal
Jun 17 <bgs100> [19:27:46] Change to the directory of your file.
Jun 17 <bgs100> [19:28:04] And type:
Jun 17 <bgs100> [19:28:39] gcc -Wall 1.c -o 1
Jun 17 <bgs100> [19:28:57] Replacing 1.c with your filename
Jun 17 <bgs100> [19:29:09] And you can change 1 to something else, if you wanted.
Jun 17 <bgs100> [19:29:15] want*
Jun 17 * bgs100 [19:29:28] checks for confirmation.
Jun 17 <pedro3005> [19:29:32] what is Wall?
Jun 17 <bgs100> [19:29:41] It is Warnings-all
Jun 17 <bgs100> [19:30:21] It means it will show you more wanrings than it normally would, like if you left out the return 0 (which it defaults to).
Jun 17 <bgs100> [19:30:43] It also warns if you have unused variables and such.
Jun 17 <pedro3005> [19:30:58] ok
Jun 17 <juju2143> [19:31:10] ok
Jun 17 <bgs100> [19:31:16] Did everyone run the command successfully?
Jun 17 <bgs100> [19:31:19] seidos ?
Jun 17 <seidos> [19:31:34] typing it now
Jun 17 <bgs100> [19:31:40] Okay
Jun 17 <seidos> [19:32:09] it worked, I have an executable "1"
Jun 17 <bgs100> [19:32:14] Yay!
Jun 17 <bgs100> [19:32:22] Now, run the command:
Jun 17 <bgs100> [19:32:24] ./1
Jun 17 <seidos> [19:32:32] it runs
Jun 17 <bgs100> [19:32:44] Did it say "Hello, solar system!" ?
Jun 17 <seidos> [19:32:57] yeah
Jun 17 <juju2143> [19:33:00] yep
Jun 17 <bgs100> [19:33:08] pedro3005 ?
Jun 17 <seidos> [19:33:13] there is no reply though
Jun 17 * pedro3005 [19:33:15] falls asleep
Jun 17 <pedro3005> [19:33:19] bgs100, uhm yeah
Jun 17 <bgs100> [19:33:23] seidos ?!
Jun 17 <bgs100> [19:33:33] seidos, Did it not print out the message?
Jun 17 <bgs100> [19:33:34] OH
Jun 17 <bgs100> [19:33:39] I get what you mean :P
Jun 17 <bgs100> [19:33:41] nvm
Jun 17 <seidos> [19:33:41] just a joke, sorry
Jun 17 <bgs100> [19:33:49] seidos, np
Jun 17 <bgs100> [19:33:59] Okay
Jun 17 <pedro3005> [19:34:02] lol, I just imagined the solar system saying hello back
Jun 17 <bgs100> [19:34:08] Does everyone here know about newlines?
Jun 17 <bgs100> [19:34:10] pedro3005, Lol
Jun 17 <seidos> [19:34:17] heh heh
Jun 17 <pedro3005> [19:34:17] its voice is very manly
Jun 17 * seidos [19:34:23] doesn't know about newlines
Jun 17 <bgs100> [19:34:23] lolwut
Jun 17 <pedro3005> [19:34:29] \n
Jun 17 <pedro3005> [19:34:31] sure
Jun 17 <bgs100> [19:34:59] Okay, for seidos's benefit, then,
Jun 17 <juju2143> [19:35:24] loool
Jun 17 <juju2143> [19:35:39] yeah, \n<
Jun 17 <juju2143> [19:35:44] or the enter key
Jun 17 <juju2143> [19:35:45] \n
Jun 17 <seidos> [19:35:47] \n is newlines?
Jun 17 <pedro3005> [19:35:53] yessir
Jun 17 <seidos> [19:35:56] ah
Jun 17 <seidos> [19:36:01] then I guess I new about it
Jun 17 <seidos> [19:36:03] sorry
Jun 17 <bgs100> [19:36:05] seidos, Try taking the "\n" out of "Hello, solar system!\n", and compiling (running "gcc -Wall 1.c -o 1") again, and running the executable again
Jun 17 <bgs100> [19:36:14] Oh
Jun 17 <bgs100> [19:36:18] You knew about it?
Jun 17 <bgs100> [19:36:19] xP
Jun 17 <bgs100> [19:36:28] ...nvm then
Jun 17 <bgs100> [19:36:31] Okay
Jun 17 * seidos [19:36:35] does it anyway as punishment for not knowing newlines was \n
Jun 17 <bgs100> [19:36:46] Moving on to variables and fancier printf
Jun 17 <bgs100> [19:36:49] seidos, Lol, okay
Jun 17 <bgs100> [19:37:05] Before the printf, have a line that says:
Jun 17 <bgs100> [19:37:13] int a = 5;
Jun 17 <bgs100> [19:37:40] Then, change the printf line to:
Jun 17 <bgs100> [19:38:10] printf("Does Mr.Solar System like the number %d\n", a);
Jun 17 <juju2143> [19:38:51] lol
Jun 17 <bgs100> [19:38:53] Er
Jun 17 <bgs100> [19:38:56] printf("Does Mr.Solar System like the number %d?\n", a);
Jun 17 <bgs100> [19:39:01] Forgot the question mark
Jun 17 <bgs100> [19:39:03] Sorry
Jun 17 <bgs100> [19:39:08] And save
Jun 17 <bgs100> [19:39:22] Tell when you're done, please.
Jun 17 <pedro3005> [19:39:58] done
Jun 17 * bgs100 [19:40:04] patiently waits for juju2143 and seidos
Jun 17 <juju2143> [19:40:07] done
Jun 17 <seidos> [19:40:33] compiling
Jun 17 <bgs100> [19:40:34] seidos ?
Jun 17 <bgs100> [19:40:37] :|
Jun 17 <bgs100> [19:40:46] I didnt say to compile yet ;P
Jun 17 <bgs100> [19:40:50] didn't*
Jun 17 <seidos> [19:40:58] oh
Jun 17 <seidos> [19:41:02] well I did anyway
Jun 17 <bgs100> [19:41:05] Well, uh, you're ahead
Jun 17 <bgs100> [19:41:13] juju2143, pedro3005 Compile, then :p
Jun 17 <juju2143> [19:41:22] done
Jun 17 <pedro3005> [19:41:24] did that ages ago
Jun 17 <seidos> [19:41:25] that's a first
Jun 17 <pedro3005> [19:41:25] :p
Jun 17 <bgs100> [19:41:28] pedro3005, ...
Jun 17 <bgs100> [19:41:33] x|
Jun 17 <juju2143> [19:41:35] lol.
Jun 17 <bgs100> [19:41:36] Anyway
Jun 17 <bgs100> [19:41:43] Now run it, and tell me the output.
Jun 17 <seidos> [19:41:44] pedro3005, snatches away my glory
Jun 17 <pedro3005> [19:41:49] bgs100, what's the difference between %d and %i?
Jun 17 <bgs100> [19:42:02] seidos, Wasn't exactly glory.... MORE LIKE NOT FOLLOWING DIRECTIONS!
Jun 17 <bgs100> [19:42:04] (jk)
Jun 17 <pedro3005> [19:42:44] bgs100, well you don't need to go so slowly :p
Jun 17 <bgs100> [19:42:53] pedro3005, They're the same
Jun 17 <bgs100> [19:43:09] Says man 3 printf
Jun 17 <juju2143> [19:43:18] julien@maelstrom:~/ctests$ ./01
Jun 17 <juju2143> [19:43:18] Does Mr.Solar System like the number 5?
Jun 17 <bgs100> [19:43:20] pedro3005, Okay, I'll go faster
Jun 17 * bgs100 [19:43:32] claps for pedro3005 actually giving him the output
Jun 17 <pedro3005> [19:43:32] thanks
Jun 17 <juju2143> [19:43:33] waii
Jun 17 <bgs100> [19:43:34] ER
Jun 17 <seidos> [19:43:36] I wonder which one I'll remember more %d or %i
Jun 17 <bgs100> [19:43:36] juju2143, *
Jun 17 <bgs100> [19:43:38] Sorry
Jun 17 <juju2143> [19:43:46]
Jun 17 <pedro3005> [19:43:55] bgs100, you just can't get over me :P
Jun 17 <juju2143> [19:43:56] %d is decimal and %i integer?
Jun 17 <seidos> [19:44:16] but we used %d for an int
Jun 17 <seidos> [19:44:21] at least I did, and it worked
Jun 17 <bgs100> [19:44:24] After I tell you to make edits, I'll just say SCRO for Save/Compile/Run/Tell me Output :P
Jun 17 <seidos> [19:44:38] ooo
Jun 17 <bgs100> [19:44:40] seidos, %d is the same as %i , it would work too
Jun 17 * seidos [19:44:59] is ready for more edits
Jun 17 <bgs100> [19:45:03] juju2143, probably
Jun 17 <bgs100> [19:45:16] "d, i The int argument is converted to signed decimal notation."
Jun 17 <bgs100> [19:45:20] from man
Jun 17 <bgs100> [19:45:21] Okay
Jun 17 <bgs100> [19:45:36] So, you made a variable, a, assigned it, and used it for formatting in printf.
Jun 17 <bgs100> [19:45:40] So now
Jun 17 <bgs100> [19:45:58] Change the line with assigning a to:
Jun 17 <bgs100> [19:46:25] int solar_system_fav = 42, a = 5;
Jun 17 <bgs100> [19:46:42] And after that line, write:
Jun 17 <bgs100> [19:46:51] int ssf = solar_system_fav;
Jun 17 <bgs100> [19:47:19] Okay?
Jun 17 <bgs100> [19:47:27] After the printf line,
Jun 17 <bgs100> [19:47:35] type (multiple lines):
Jun 17 <bgs100> [19:47:53] if (a == ssf)
Jun 17 <bgs100> [19:48:07] printf("SOLAR SYSTEM LIKES!\n");
Jun 17 <bgs100> [19:48:12] else
Jun 17 <bgs100> [19:48:27] printf("DO NOT LIKE!!!\n");
Jun 17 <bgs100> [19:48:34] Okay?
Jun 17 <seidos> [19:48:49] SCRO?
Jun 17 <bgs100> [19:48:59] Not yet, one sec
Jun 17 <bgs100> [19:49:19] I have to copy the lines into my editor (wrote them in IRC) :P
Jun 17 <bgs100> [19:49:38] Okay
Jun 17 <bgs100> [19:49:41] SCRO, everyone
Jun 17 <pedro3005> [19:49:56] what's SCRO?
Jun 17 <bgs100> [19:50:00] ...
Jun 17 <pedro3005> [19:50:05] :P
Jun 17 <seidos> [19:50:10] arg, got an error
Jun 17 <seidos> [19:50:12] typo
Jun 17 <bgs100> [19:50:12] <bgs100> After I tell you to make edits, I'll just say SCRO for Save/Compile/Run/Tell me Output :P
Jun 17 <seidos> [19:50:14] I put \N
Jun 17 <pedro3005> [19:50:20] oh ok
Jun 17 <bgs100> [19:50:40] juju2143 ?
Jun 17 <juju2143> [19:50:53] hm
Jun 17 <bgs100> [19:50:59] What?
Jun 17 <juju2143> [19:51:00] k
Jun 17 <seidos> [19:51:04] and I put "print" instead of "printf"
Jun 17 <bgs100> [19:51:05] Okay
Jun 17 <bgs100> [19:51:09] seidos, :p
Jun 17 <bgs100> [19:51:23] Maybe copy the lines from IRC?
Jun 17 <seidos> [19:51:42] kevin@kevin-laptop:~/programs/c/irc-class$ ./1
Jun 17 <seidos> [19:51:43] Does Mr. Solar System like the number 5
Jun 17 <seidos> [19:51:43] DO NOT LIKE!!!
Jun 17 <seidos> [19:51:47] that's my output
Jun 17 <bgs100> [19:51:47] GOOD!
Jun 17 <bgs100> [19:52:00] Now I'll explain some of the stuff we added.
Jun 17 <seidos> [19:52:05] and I have to eat lunch now, bbasap
Jun 17 <bgs100> [19:52:27] seidos, alright, you can read the logs when you get back, I suppose
Jun 17 <bgs100> [19:52:31] So:
Jun 17 <bgs100> [19:52:32] int solar_system_fav = 42, a = 5;
Jun 17 <bgs100> [19:52:32] int ssf = solar_system_fav;
Jun 17 <bgs100> [19:52:40] This adds 2 things:
Jun 17 <seidos> [19:52:53] I'm gonna' stay logged in, if you're gone before I get back, thank you for the lesson
Jun 17 <bgs100> [19:53:17] seidos, Thanks
Jun 17 <bgs100> [19:53:28] No problem
Jun 17 <bgs100> [19:53:31] Anyway
Jun 17 <juju2143> [19:54:17] k
Jun 17 <bgs100> [19:54:23] You can make multiple definitions/assignment in one "int" (or any other kind of type) statement.
Jun 17 <bgs100> [19:54:29] As the first line shows.
Jun 17 <bgs100> [19:54:42] Just seperate the variables with commas
Jun 17 <bgs100> [19:54:58] And
Jun 17 <bgs100> [19:55:15] Since a variable is the value it's holding, you can assign a variable to a variable
Jun 17 <pedro3005> [19:55:52] yeah
Jun 17 <bgs100> [19:55:54] In this case, I just decided to make ssf a shortcut for solar_system_fav (which was demonstaarting for seidos that variable names can have underscores)
Jun 17 <bgs100> [19:56:21] Although, if you changed solar_system_fav afterwards, ssf wouldn't be changed, or vice versa.
Jun 17 * bgs100 [19:56:34] just thought of a good intro to pointers for later
Jun 17 <bgs100> [19:56:41] Alright
Jun 17 <bgs100> [19:57:11] Let's dive into functions and for loops.
Jun 17 <bgs100> [19:57:20] I'll pastebin the code, and you can copy it
Jun 17 <bgs100> [19:57:23] one sec
Jun 17 <pedro3005> [19:58:48] for loops are cool
Jun 17 <juju2143> [19:59:20] lol
Jun 17 <juju2143> [19:59:23] yeah.
Jun 17 <bgs100> [20:01:41] Okay
Jun 17 <bgs100> [20:01:46] Here we go, sorry for the wait:
Jun 17 <bgs100> [20:02:22] http://pastebin.com/WT0NfqzU
Jun 17 <bgs100> [20:02:44] Replace your file with that, and SCRO
Jun 17 <bgs100> [20:03:42] hm, I'll add syntax highlighting next time, sorry
Jun 17 * bgs100 [20:04:57] waits for the reporting of the output...
Jun 17 <bgs100> [20:05:10] ...from juju2143 and pedro3005
Jun 17 <pedro3005> [20:05:40] oh ok
Jun 17 <bgs100> [20:05:51] Well?
Jun 17 <pedro3005> [20:06:06] it only likes 42
Jun 17 <juju2143> [20:06:38] julien@maelstrom:~/ctests$ ./01
Jun 17 <juju2143> [20:06:38] DO NOT LIKE 0!!!
Jun 17 <juju2143> [20:06:38] DO NOT LIKE 1!!!
Jun 17 <juju2143> [20:06:40] ...
Jun 17 <juju2143> [20:06:50] DO NOT LIKE 41!!!
Jun 17 <juju2143> [20:06:51] SOLAR SYSTEM LIKES 42!
Jun 17 <juju2143> [20:06:51] julien@maelstrom:~/ctests$
Jun 17 <bgs100> [20:06:55] Good
Jun 17 <bgs100> [20:07:07] Let's go through it.
Jun 17 <bgs100> [20:07:13] int solar_system_fav = 42;
Jun 17 <bgs100> [20:07:21] This makes a global variable.
Jun 17 <pedro3005> [20:07:23] yeah I see how it works
Jun 17 <pedro3005> [20:07:29] good for loop breaking method
Jun 17 <bgs100> [20:07:30] It can be accessed in any function
Jun 17 <bgs100> [20:07:42] Okay
Jun 17 <bgs100> [20:07:54] After that, we make a NEW FUNCTION!
Jun 17 <bgs100> [20:07:58] YEAH!
Jun 17 <pedro3005> [20:08:13] you could've done just for (i = 0; i <= 50 && !solar_check(i); i++); couldn't you?
Jun 17 <bgs100> [20:08:23] It takes one parameter (or sometimes called argument), the integer n.
Jun 17 <bgs100> [20:08:27] pedro3005, SSSHHHHHH
Jun 17 <bgs100> [20:08:37] ... Yeah, though
Jun 17 * bgs100 [20:08:44] gives pedro3005 a star
Jun 17 <pedro3005> [20:08:49]
Jun 17 <bgs100> [20:08:53] Anyway
Jun 17 * pedro3005 [20:08:53] takes star
Jun 17 <bgs100> [20:09:13] So we check if n is equivalent to the solar system's favorite number
Jun 17 <bgs100> [20:09:36] If so, print it, and return 1 (representing boolean True)
Jun 17 <bgs100> [20:09:53] If not, print as much, and return 0 (for false)
Jun 17 <juju2143> [20:10:06] lol
Jun 17 <bgs100> [20:10:10] Unlike most languages, C does not have special boolean values built-in
Jun 17 <bgs100> [20:10:26] 0 = False, pretty much everything else = true
Jun 17 <bgs100> [20:10:36] Okay
Jun 17 <bgs100> [20:10:56] So, in main, we obviously make i and worked, with worked starting as 0
Jun 17 <bgs100> [20:11:13] Then, the for loop,
Jun 17 <bgs100> [20:11:27] first sets i to 0 (I could've put worked here too),
Jun 17 <bgs100> [20:12:30] and then, like a while loop, each time checks if i is less-than/equal-to 50, and if the opposite of worked (that's what the ! does) is true (as in, it has continued to fail).
Jun 17 <bgs100> [20:12:55] And each time we set worked to the result of solar_checked(i) with our current i
Jun 17 <bgs100> [20:12:57] Oh
Jun 17 <bgs100> [20:13:06] And each time, it increments i by one
Jun 17 <bgs100> [20:13:11] I could have also done:
Jun 17 <bgs100> [20:13:15] ++i
Jun 17 <bgs100> [20:13:18] i += 1
Jun 17 <bgs100> [20:13:23] i = i + 1
Jun 17 <bgs100> [20:13:25] etc.
Jun 17 <bgs100> [20:13:46] So yeah
Jun 17 <bgs100> [20:13:54] Everyone good?
Jun 17 <bgs100> [20:13:57] Any questions?
Jun 17 * bgs100 [20:14:02] pings juju2143 and pedro3005
Jun 17 <pedro3005> [20:14:14] bgs100, it's cool
Jun 17 <pedro3005> [20:14:24] you should speed up :p
Jun 17 <juju2143> [20:14:26] kay
Jun 17 <bgs100> [20:14:28] >:|
Jun 17 <juju2143> [20:14:31] ...
Jun 17 <bgs100> [20:14:36] (jk)
Jun 17 <pedro3005> [20:14:43] I don't know about juju2143 but I've done for loops, switches, bit of functions
Jun 17 <bgs100> [20:14:56] Fine
Jun 17 <bgs100> [20:15:07] juju2143, What do you know already?
Jun 17 <pedro3005> [20:15:09] pointers is a good subject though
Jun 17 <pedro3005> [20:15:26] I don't feel too comfortable around them
Jun 17 <bgs100> [20:15:37] pedro3005, What about structs / arrays?
Jun 17 <juju2143> [20:15:39] yeah, pointers
Jun 17 <juju2143> [20:15:49] I learnt that at school
Jun 17 <bgs100> [20:16:00] Want me to go to pointers?
Jun 17 <pedro3005> [20:16:02] bgs100, I read about them, but it's best to go over them again
Jun 17 <pedro3005> [20:16:18] structs / arrays need teaching too. whatever you feel needs to come first
Jun 17 <bgs100> [20:16:21] pedro3005, You don't think it's best to go over loops/functions again >_>
Jun 17 <bgs100> [20:16:24] Okay
Jun 17 <bgs100> [20:16:42] Pointers, then.
Jun 17 <bgs100> [20:16:46] Alright
Jun 17 <bgs100> [20:17:04] I'll make a program
Jun 17 <bgs100> [20:17:06] Start a new file
Jun 17 <bgs100> [20:17:09] Name it 2.c
Jun 17 <juju2143> [20:17:12] I need aluminium foil!
Jun 17 <bgs100> [20:17:23] ?
Jun 17 <pedro3005> [20:17:24] started
Jun 17 <juju2143> [20:17:47] k
Jun 17 <bgs100> [20:20:44] Okay
Jun 17 <bgs100> [20:20:46] Pastebining
Jun 17 <bgs100> [20:21:16] http://pastebin.com/GaQEwDuM
Jun 17 <bgs100> [20:21:22] Copy and SCRO
Jun 17 <bgs100> [20:21:39] Maybe I'll be explaining stuff you don't know, for once :P
Jun 17 <pedro3005> [20:22:00] i_pointer is 0xbfe1566c
Jun 17 <pedro3005> [20:22:00] i = 5, i_clone = 5, *i_pointer = 5
Jun 17 <pedro3005> [20:22:01] i = 42, i_clone = 5, *i_pointer = 42
Jun 17 <pedro3005> [20:22:01] i = 9000, i_clone = 5, *i_pointer = 9000
Jun 17 <pedro3005> [20:22:01] i = -7, i_clone = 5, *i_pointer = -7
Jun 17 <bgs100> [20:22:21] Now run it again
Jun 17 <bgs100> [20:22:25] And tell me the output
Jun 17 <pedro3005> [20:22:39] i_pointer is 0xbfad783c
Jun 17 <pedro3005> [20:22:44] rest is the same
Jun 17 <bgs100> [20:23:12] Yes
Jun 17 <bgs100> [20:23:30] Okay
Jun 17 <bgs100> [20:23:35] Explain-time
Jun 17 <bgs100> [20:23:39] Also, juju2143 ready?
Jun 17 <bgs100> [20:24:30] pedro3005, Well, as you've obviously noticed *i_pointer is always the same as i. i_clone is only the same as the original i.
Jun 17 <pedro3005> [20:24:56] oohh right
Jun 17 <pedro3005> [20:25:06] because *i_pointer points to i
Jun 17 <bgs100> [20:25:20] The reason that i_clone remains the same is obvious.
Jun 17 <bgs100> [20:25:22] pedro3005, Yes
Jun 17 <bgs100> [20:25:24] int *i_pointer = &i;
Jun 17 <pedro3005> [20:25:29] whereas i_clone is just (initially) equal to i
Jun 17 <pedro3005> [20:25:39] but the changes that happen to i don't happen to its clone
Jun 17 <bgs100> [20:25:54] One sec, Dad is talking to me
Jun 17 <pedro3005> [20:26:37] lol, you capitalize it
Jun 17 <pedro3005> [20:26:39] like he's god
Jun 17 <bgs100> [20:28:06] No, in this cae Dad is a proper noun because I did not say "my dad".
Jun 17 <bgs100> [20:28:12] case*
Jun 17 <bgs100> [20:28:19] pedro3005, That is why I capitalized it.
Jun 17 <bgs100> [20:28:32] Anyway
Jun 17 <bgs100> [20:28:44] So, take this line:
Jun 17 <bgs100> [20:28:48] int *i_pointer = &i;
Jun 17 <bgs100> [20:29:08] This is assinging int_pointer the number that is the address in memory of i.
Jun 17 <pedro3005> [20:29:36] what does the * mean?
Jun 17 <bgs100> [20:29:45] In this case, pointer.
Jun 17 <bgs100> [20:29:51] pointer to and int
Jun 17 <Shadowwolf> [20:30:27] Hi, guys.
Jun 17 <bgs100> [20:30:39] The bits, somewhere in your hardware, which have their voltages in various values representing the binary which represents the current value of i.
Jun 17 <bgs100> [20:30:47] That, is what int_pointer is.
Jun 17 <bgs100> [20:30:51] Hi Shadowwolf
Jun 17 <bgs100> [20:30:57] I'm giving a C class
Jun 17 <bgs100> [20:31:08] Er
Jun 17 <bgs100> [20:31:10] i_pointer
Jun 17 <bgs100> [20:31:12] failed
Jun 17 <Shadowwolf> [20:31:16] Lol.
Jun 17 <bgs100> [20:31:29] pedro3005, Now,
Jun 17 <bgs100> [20:31:32] let's take:
Jun 17 <bgs100> [20:31:33] printf("i = %d, i_clone = %d, *i_pointer = %d\n", i, i_clone, *i_pointer);
Jun 17 <bgs100> [20:31:42] It's obvious what most of this does
Jun 17 <bgs100> [20:31:45] But
Jun 17 <pedro3005> [20:32:07] prints shit
Jun 17 <bgs100> [20:32:14] *i_pointer is the is accessing the address the i_pointer carries and gets the value that is there, which is the same as i.
Jun 17 <bgs100> [20:32:22] pedro3005, ...
Jun 17 * bgs100 [20:32:34] takes pedro3005's star away
Jun 17 <pedro3005> [20:32:42] :/
Jun 17 <bgs100> [20:32:49] Anyway
Jun 17 <bgs100> [20:32:54] pedro3005, get it?
Jun 17 <pedro3005> [20:33:02] Yes
Jun 17 <bgs100> [20:33:18] Yay
Jun 17 <pedro3005> [20:33:26] are pointers just that?
Jun 17 <bgs100> [20:33:26] Okay
Jun 17 <bgs100> [20:33:44] Pretty much
Jun 17 <bgs100> [20:33:56] Honestly, the concept itself is pretty simple
Jun 17 <bgs100> [20:34:05] pedro3005, Alright, preparing another program
Jun 17 <bgs100> [20:34:42] pedro3005, Save this is another file, too
Jun 17 <bgs100> [20:34:46] ( 3.c )
Jun 17 <pedro3005> [20:35:46] (_*_)
Jun 17 <juju2143> [20:36:38] brb supper
Jun 17 <bgs100> [20:38:30] pedro3005, Pastebining
Jun 17 <bgs100> [20:38:56] pedro3005, http://pastebin.com/UX8xnwBD
Jun 17 <bgs100> [20:39:00] Copy and SCRO
Jun 17 <bgs100> [20:39:02] brb
Jun 17 <pedro3005> [20:39:19] n = 5
Jun 17 <pedro3005> [20:39:19] n = 5
Jun 17 <pedro3005> [20:39:19] n = 1337
Jun 17 <bgs100> [20:40:57] Yep
Jun 17 <bgs100> [20:41:02] Do you know why?
Jun 17 <pedro3005> [20:41:32] let me analyze it
Jun 17 <bgs100> [20:41:42] okay
Jun 17 <pedro3005> [20:42:06] bgs100, the first function doesn't actually change the initial variable
Jun 17 <pedro3005> [20:42:09] just its copy of it
Jun 17 <pedro3005> [20:42:16] but the second function goes right down to the roots
Jun 17 <bgs100> [20:42:17] Correct!
Jun 17 * bgs100 [20:42:29] gives pedro3005 his star back
Jun 17 <bgs100> [20:42:42] pedro3005, Explain the second function more in depth, please.
Jun 17 <pedro3005> [20:43:06] it actually changes the memory location which the initial variable reflects
Jun 17 <pedro3005> [20:43:12] therefore changes the variable
Jun 17 <bgs100> [20:43:23] Exactly.
Jun 17 * bgs100 [20:43:34] gives pedro3005 a shinier new star
Jun 17 <bgs100> [20:43:56] You appear to have a pretty firm grasp of pointers...
Jun 17 <bgs100> [20:44:03] pedro3005, What do you know about structs?
Jun 17 <pedro3005> [20:44:26] bgs100, I'll probably recall a lot as you start going over them
Jun 17 <bgs100> [20:44:32] ...
Jun 17 <bgs100> [20:44:38] What don't you know? >:|
Jun 17 <bgs100> [20:44:49] ...oh
Jun 17 <bgs100> [20:44:50] well
Jun 17 <pedro3005> [20:44:53] I don't know
Jun 17 <bgs100> [20:45:02] pedro3005, Lol.
Jun 17 <bgs100> [20:45:20] Anyway, structs it is, I suppose...
Jun 17 <pedro3005> [20:45:28] sure
Jun 17 * bgs100 [20:45:40] is here, teaching a class that already knows most of the material... ;P
Jun 17 <bgs100> [20:45:56] I bet I'll have a lot less of that in Common Lisp...
Jun 17 <bgs100> [20:46:06] okay
Jun 17 <pedro3005> [20:46:17] (lambda x blabla)
Jun 17 <pedro3005> [20:46:17] xD
Jun 17 <bgs100> [20:46:22] Fail
Jun 17 <bgs100> [20:46:32] (lambda (x) blabla)
Jun 17 <bgs100> [20:46:34] Silly.
Jun 17 <bgs100> [20:46:45] Anyway
Jun 17 <bgs100> [20:47:02] I intend to also show how structs + functions is a lot like OOP
Jun 17 <pedro3005> [20:50:06] bgs100, go o
Jun 17 <pedro3005> [20:50:08] on
Jun 17 <bgs100> [20:50:14] I am
Jun 17 <bgs100> [20:50:17] I'm coding
Jun 17 <bgs100> [20:50:35] Making the next example code
Jun 17 <bgs100> [20:53:35] Alright
Jun 17 <bgs100> [20:53:39] Pastebining
Jun 17 <bgs100> [20:53:56] Save this in a new file
Jun 17 <bgs100> [20:54:19] http://pastebin.com/YW55pamf
Jun 17 <bgs100> [20:54:22] pedro3005, ^
Jun 17 <bgs100> [20:54:29] SCRO
Jun 17 <pedro3005> [20:54:53] Rectangle 3x4
Jun 17 <pedro3005> [20:54:54] Rectangle 9x7
Jun 17 <bgs100> [20:55:07] Good
Jun 17 <bgs100> [20:55:09] Now
Jun 17 <bgs100> [20:55:16] Think of rectangle as a class.
Jun 17 <bgs100> [20:55:23] makeRect is it's constructor method.
Jun 17 <bgs100> [20:55:35] printRectangle is it's sole method.
Jun 17 <bgs100> [20:55:50] printRectangle(rect) , rect.printRectangle()
Jun 17 <bgs100> [20:55:56] Not so much difference.
Jun 17 <pedro3005> [20:56:06] ok
Jun 17 <bgs100> [20:56:10] Although
Jun 17 <pedro3005> [20:56:17] it appears you created a type called rectangle
Jun 17 <bgs100> [20:56:45] with classes you would have the advantage of being able to name it rect.print() without conflicting with another classes print.
Jun 17 <bgs100> [20:56:50] pedro3005, Yes, go on.
Jun 17 <bgs100> [20:57:00] Explain the typedef
Jun 17 <pedro3005> [20:57:20] hey, who's the teacher here? :p
Jun 17 <pedro3005> [20:57:25] I don't know :x
Jun 17 <seidos> [20:57:25] I still don't really get classes, it is a nebulous concept to me, I've never heard of structs before
Jun 17 <bgs100> [20:57:27] I'm asking you.
Jun 17 <bgs100> [20:57:31] pedro3005, Good
Jun 17 <bgs100> [20:57:39] Hi seidos!
Jun 17 <seidos> [20:57:48] Hi, I did my best to catch up
Jun 17 <bgs100> [20:57:58] pedro3005 was being very impatient, so I skipped to his level
Jun 17 <seidos> [20:58:02] but I think pedro3005 has a much better grasp of the material than myself
Jun 17 <bgs100> [20:58:05] Which is not the same as yours
Jun 17 <pedro3005> [20:58:22] sorry :/
Jun 17 <bgs100> [20:58:25] seidos, I will go back to your level in C in a few minutes, okay?
Jun 17 <seidos> [20:58:27] eh, I think it's my fault
Jun 17 <seidos> [20:58:34] I should be at his level, he learns faster than I do I think
Jun 17 <bgs100> [20:58:41] No it's not!
Jun 17 <seidos> [20:58:46] he's always passing me up when we learn python
Jun 17 <bgs100> [20:58:46] He's learned some C before.
Jun 17 <pedro3005> [20:59:06] seidos, don't worry man, you'll learn it
Jun 17 <seidos> [20:59:09] yeah, but I could've learned with him, I got frustrated at my inability to keep up with him
Jun 17 <seidos> [20:59:23] seriously he learns faster than me, moving on
Jun 17 <bgs100> [20:59:38] Well still, He and juju2143 knew a lot of C before.
Jun 17 <pedro3005> [20:59:49] I wouldn't call it a lot
Jun 17 <seidos> [20:59:51] I took a class on c/c++ in college
Jun 17 <seidos> [20:59:57] there's no excuse for me
Jun 17 * seidos [21:00:03] weeps in bitter tears
Jun 17 <seidos> [21:00:05] heh heh
Jun 17 * pedro3005 [21:00:10] pets seidos
Jun 17 <pedro3005> [21:00:13] it'll be alright
Jun 17 * bgs100 [21:00:20] tosses some kleenexes in
Jun 17 * bgs100 [21:00:29] goes back to blackboard
Jun 17 <bgs100> [21:00:44] seidos, Well, I'll get back to you in a few minutes, k?
Jun 17 <seidos> [21:00:50] no petting, that's gay
Jun 17 <pedro3005> [21:00:53] It's alright if you try to get the concept of classes into seidos' head
Jun 17 <seidos> [21:01:03] just keep going, if I think of an intelligent question, I'll ask
Jun 17 <bgs100> [21:01:09] Alright, cool
Jun 17 <bgs100> [21:01:21] pedro3005, Here's what the typedef does:
Jun 17 <bgs100> [21:01:25] If it wasn't there,
Jun 17 <bgs100> [21:01:37] Instead of rectangle rect; to declare a rectangle,
Jun 17 <bgs100> [21:01:47] you'd need struct rectangle rect;
Jun 17 <bgs100> [21:02:07] The typedef simply makes rectangle a shortcut for the type struct rectangle
Jun 17 <seidos> [21:02:13] this question probably isn't very intelligent, but I have choice, it has to be asked. are we still looking at the rectangle file?typedef? are we still looking at
Jun 17 <bgs100> [21:02:18] So we save a lot of typing
Jun 17 <seidos> [21:02:20] oops
Jun 17 <bgs100> [21:02:36] seidos, We are talking about the structure/type rectangle.
Jun 17 <pedro3005> [21:02:45] bgs100, so the type rectangle is simply a struct rectangle?
Jun 17 <bgs100> [21:02:45] Here's the pastebin:
Jun 17 <pedro3005> [21:02:51] and instance of the struct?
Jun 17 <bgs100> [21:02:58] seidos, http://pastebin.com/YW55pamf
Jun 17 <seidos> [21:03:06] yeah, I got the pastebin
Jun 17 <bgs100> [21:03:09] pedro3005, Yes, rectangle = struct rectangle.
Jun 17 <seidos> [21:03:10] and I scro'd
Jun 17 <bgs100> [21:03:12] seidos, Ah
Jun 17 <bgs100> [21:03:17] Okay, good
Jun 17 <seidos> [21:03:21] typedef through me off
Jun 17 <bgs100> [21:03:29] It threw pedro3005 off too
Jun 17 <seidos> [21:03:32] I searched the file for "typedef" and the search didn't find any hits
Jun 17 <bgs100> [21:03:48] Okay
Jun 17 <bgs100> [21:03:52] Well anyway
Jun 17 <pedro3005> [21:03:58] bgs100, I don't get why the function is type rectangle
Jun 17 <bgs100> [21:04:05] So it just makes the programmer be able to type less
Jun 17 <bgs100> [21:04:14] pedro3005, Because it returns a rectangle
Jun 17 <pedro3005> [21:04:18] oh
Jun 17 <pedro3005> [21:04:19] right
Jun 17 <pedro3005> [21:04:24] lol << failure
Jun 17 <bgs100> [21:04:34] Like solar_check() return an int?
Jun 17 <bgs100> [21:04:43] pedro3005, C class, not C++
Jun 17 <seidos> [21:04:46] what the heck, I see typedef right there and the search didn't find it
Jun 17 <pedro3005> [21:04:51] bgs100, right right
Jun 17 <bgs100> [21:04:52] seidos, :|
Jun 17 <bgs100> [21:05:02] Anywayz
Jun 17 <seidos> [21:05:08] sorry, I thought I knew how to use vim, apparently not
Jun 17 <bgs100> [21:05:15] seidos, Heh
Jun 17 <bgs100> [21:05:28] IIRc you have to be before the text
Jun 17 <bgs100> [21:05:32] I mean the cursor has to be
Jun 17 <bgs100> [21:05:53] So
Jun 17 <seidos> [21:05:57] I thought it would highlight the hit, but it doesn't
Jun 17 <seidos> [21:06:00] sorry
Jun 17 <bgs100> [21:06:03] np, lol
Jun 17 <bgs100> [21:06:08] Not exactly a big deal.
Jun 17 <bgs100> [21:06:16] pedro3005, one sec
Jun 17 <bgs100> [21:06:28] seidos, Okay, a struct is the definition of a data type.
Jun 17 <bgs100> [21:06:42] It has named parts of it, like for the rectangle, w and h
Jun 17 <seidos> [21:06:45] so rectangle is a data type?
Jun 17 <bgs100> [21:06:48] Right
Jun 17 <pedro3005> [21:06:53] bgs100, ok I understand the file
Jun 17 <bgs100> [21:06:59] It's just a collection of variables
Jun 17 <seidos> [21:07:02] that makes more sense
Jun 17 <bgs100> [21:07:03] pedro3005, Alright one sec
Jun 17 <seidos> [21:07:23] I think I get it
Jun 17 <bgs100> [21:07:29] seidos, And makerect makes a new rectangle with the width and height specified as parameters
Jun 17 <bgs100> [21:07:33] makeRect*
Jun 17 <bgs100> [21:07:43] It then returns the rectangle
Jun 17 <seidos> [21:07:59] hmmm, didn't really get that until you explained it
Jun 17 <bgs100> [21:08:06] printRectangle prints out a rectangle, as you've seen from your SCRO
Jun 17 <seidos> [21:08:09] so where is the declaration of the type?
Jun 17 <seidos> [21:08:11] at typedef?
Jun 17 <bgs100> [21:08:16] Well,
Jun 17 <seidos> [21:08:23] then rectangle makeRect is doing something with the type?
Jun 17 <bgs100> [21:08:26] making the struct at all made a new type
Jun 17 <bgs100> [21:08:37] Without the typedef,
Jun 17 <bgs100> [21:08:49] to declare a rectangle you'd have to say "struct rectangle rect"
Jun 17 <bgs100> [21:09:01] whereas with the typedef you just say
Jun 17 <bgs100> [21:09:06] "rectangle rect"
Jun 17 <seidos> [21:09:06] hmmm forgot about the struct rectangle { sitting at the top all by itself
Jun 17 <bgs100> [21:09:21] It's just a typing shortcut, really
Jun 17 <seidos> [21:09:46] it makes sense but I can tell it's not in my long term memory
Jun 17 <bgs100> [21:10:00] well go over it some more later :p
Jun 17 <bgs100> [21:10:04] (jk)
Jun 17 <bgs100> [21:10:35] I was going to go to some simple array stuff next, which would also give me a chance to reintroduce the for loop for seidos.
Jun 17 <seidos> [21:10:37] I'll probably have to, I still have no idea how to apply any of the things I learn to ACTUAL software development
Jun 17 <bgs100> [21:10:42] Alright pedro3005 and seidos ?
Jun 17 <seidos> [21:11:14] all right by me
Jun 17 <bgs100> [21:11:18] Wait. seidos, Let's say you need to represent a contact in a mail program.
Jun 17 <pedro3005> [21:11:18] bgs100, it'd be cool if you make us use this knowledge.. like, you know, exercises.
Jun 17 <seidos> [21:11:24] I read the for loop stuff
Jun 17 <bgs100> [21:11:25] pedro3005, Okay
Jun 17 <seidos> [21:11:27] and scro'ed the file
Jun 17 <bgs100> [21:11:37] One sec
Jun 17 <seidos> [21:11:48] yeah, that's where I always epically fail
Jun 17 <seidos> [21:11:56]
Jun 17 <bgs100> [21:12:13] seidos, Let's say that a contact is a collection of a name and an email address.
Jun 17 <bgs100> [21:12:24] How would we represent a bunch of these?
Jun 17 <bgs100> [21:12:33] An array of structs!
Jun 17 <bgs100> [21:12:41] struct contact {
Jun 17 <seidos> [21:12:45] I would've said an array
Jun 17 <seidos> [21:12:48] not with structs
Jun 17 <bgs100> [21:12:56] seidos, How would that work?
Jun 17 <bgs100> [21:13:09] You could only have either the name or email,
Jun 17 <seidos> [21:13:09] put the info in the each element of the array?
Jun 17 <seidos> [21:13:14] oh
Jun 17 <seidos> [21:13:22] maybe a what are those called
Jun 17 <seidos> [21:13:26] multi-dimensional array
Jun 17 <bgs100> [21:13:29] You'd need a struct to bring both together
Jun 17 <bgs100> [21:13:41] seidos, Sort of, except with named pieces
Jun 17 <bgs100> [21:13:44] struct contact {
Jun 17 <bgs100> [21:13:49] char *name;
Jun 17 <bgs100> [21:13:53] char *email;
Jun 17 <bgs100> [21:13:55] };
Jun 17 <bgs100> [21:14:08] typedef struct contact contact;
Jun 17 <seidos> [21:14:15] #include <stdio>
Jun 17 <seidos> [21:14:16] ?
Jun 17 <bgs100> [21:14:27] contact allofthecontacts[5]
Jun 17 <bgs100> [21:14:37] seidos, I'm not making working code
Jun 17 <bgs100> [21:14:51] Just showing a piece of how you might do it
Jun 17 <seidos> [21:14:52] lol, that figures, I was typing it out
Jun 17 <bgs100> [21:15:02] Lol :p
Jun 17 <bgs100> [21:15:03] Okay
Jun 17 <bgs100> [21:15:06] Onto arrays!
Jun 17 <seidos> [21:15:10] typing it is probably a good idea anyway
Jun 17 <bgs100> [21:15:11] pedro3005, Ping
Jun 17 <pedro3005> [21:15:14] hey
Jun 17 <bgs100> [21:15:16] seidos, heh
Jun 17 <bgs100> [21:15:17] Okay
Jun 17 <bgs100> [21:15:20] Will make code
Jun 17 <bgs100> [21:16:34] Also
Jun 17 <bgs100> [21:16:47] recall that a character array/pointer is a string.
Jun 17 <seidos> [21:17:10] hmmm
Jun 17 <seidos> [21:17:23] I don't think I've heard that before
Jun 17 <pedro3005> [21:17:25] yeah
Jun 17 <pedro3005> [21:17:32] strings are arrays of chars
Jun 17 <seidos> [21:18:10] ah an array of characters is a string, that makes sense
Jun 17 <seidos> [21:18:40] wait, strings are arrays of chars but is an array of chars a string?
Jun 17 <bgs100> [21:18:42] Yeah
Jun 17 <seidos> [21:19:00] like array[5]=('k','f','s','i','p')?
Jun 17 <bgs100> [21:19:01] And don't let this confuse either of you yet, but an array is actually a pointer >_>
Jun 17 <seidos> [21:19:07] I don't know if I got the syntax right
Jun 17 <bgs100> [21:19:18] seidos, Swap those parenthesis for curly braces
Jun 17 <seidos> [21:19:23] whoa, sounds deep
Jun 17 <bgs100> [21:19:29] seidos, Indeed
Jun 17 <bgs100> [21:19:33] But ignore that for now
Jun 17 <seidos> [21:19:48] so array[5]={'k','f','s','i','p'} is a string?
Jun 17 <pedro3005> [21:20:05] bgs100, a pointer of various locations
Jun 17 <pedro3005> [21:20:07] right?
Jun 17 <bgs100> [21:20:25] Close
Jun 17 <bgs100> [21:20:34] All the locations are right next to each
Jun 17 <bgs100> [21:20:55] in the string "abc" b is right beside a in memory, and c beside b
Jun 17 <pedro3005> [21:21:06] Oh I see
Jun 17 <bgs100> [21:22:57] http://pastebin.com/3vj9XZS0
Jun 17 <bgs100> [21:23:00] pedro3005, seidos
Jun 17 <bgs100> [21:23:05] Save that as 5.c
Jun 17 <bgs100> [21:23:11] Save and Compile
Jun 17 <bgs100> [21:23:14] BUT DO NOT RUN
Jun 17 <bgs100> [21:23:19] DON'T
Jun 17 <bgs100> [21:23:26] pedro3005, seidos ^
Jun 17 <bgs100> [21:23:34] Tell me when you have it compiled
Jun 17 <seidos> [21:23:36] roger, don't run
Jun 17 <pedro3005> [21:23:41] bgs100, oopsie
Jun 17 <pedro3005> [21:23:42] too late
Jun 17 <bgs100> [21:23:46] ...........................................
Jun 17 <seidos> [21:24:06] compiled
Jun 17 <pedro3005> [21:24:08] bgs100, sorry, go ahead
Jun 17 * bgs100 [21:24:25] takes away one of pedro3005's stars and exchanges it for a ninja star, which he lightly stabs pedro3005 with.
Jun 17 * bgs100 [21:24:33] tosses away ninja star
Jun 17 <bgs100> [21:24:36] Okay
Jun 17 <bgs100> [21:25:06] seidos, pedro3005 Run it like this: ./5 Ohai there Mr Solar System
Jun 17 <bgs100> [21:25:17] Report output
Jun 17 <pedro3005> [21:25:34] Here are all of the command-line arguments:
Jun 17 <pedro3005> [21:25:35] Ohai
Jun 17 <pedro3005> [21:25:35] there
Jun 17 <pedro3005> [21:25:35] Mr.
Jun 17 <pedro3005> [21:25:35] Solar
Jun 17 <pedro3005> [21:25:35] System
Jun 17 <bgs100> [21:25:54] No . after Mr, but close enough
Jun 17 <bgs100> [21:26:03] Okay
Jun 17 <bgs100> [21:26:12] Let's look at what this is doing
Jun 17 <bgs100> [21:26:16] seidos ?
Jun 17 <bgs100> [21:26:28] seidos Did you run it ?
Jun 17 <seidos> [21:26:34] yeah
Jun 17 <seidos> [21:26:35] kevin@kevin-laptop:~/programs/c/irc-class$ ./5 Ohai there Mr Solar System
Jun 17 <seidos> [21:26:35] Here are all of the command-line arguments:
Jun 17 <seidos> [21:26:35] Ohai
Jun 17 <seidos> [21:26:35] there
Jun 17 <seidos> [21:26:35] Mr
Jun 17 <seidos> [21:26:36] Solar
Jun 17 <bgs100> [21:26:37] Okay
Jun 17 <seidos> [21:26:38] System
Jun 17 <seidos> [21:26:39] that's my output
Jun 17 <bgs100> [21:26:41] Good
Jun 17 <bgs100> [21:26:54] Okay
Jun 17 <bgs100> [21:27:12] brb, dad wants me...
Jun 17 <bgs100> [21:29:04] Back
Jun 17 <bgs100> [21:29:06] Okay
Jun 17 <bgs100> [21:29:34] seidos, pedro3005 You will notice that the main function is taking the two optional arguments mentioned in the last class.
Jun 17 <pedro3005> [21:29:57] argc, argv
Jun 17 <pedro3005> [21:30:03] they'll need explaining
Jun 17 <bgs100> [21:30:07] These arguments are called argc and argv (although you could name the boy and hisdog if you wanted)
Jun 17 <bgs100> [21:30:14] pedro3005, good
Jun 17 <bgs100> [21:30:27] Argc stands for Argument Count
Jun 17 <bgs100> [21:30:33] It is the number of arguments
Jun 17 <bgs100> [21:30:42] Argv is the Argument Vector
Jun 17 <bgs100> [21:30:50] It is the array of strings that are the arguments
Jun 17 <bgs100> [21:31:17] The first element of the argument vector is how the program was called
Jun 17 <bgs100> [21:31:36] If the program let it be displayed (it doesn't),
Jun 17 <bgs100> [21:31:40] it say ./5
Jun 17 <pedro3005> [21:32:07] but the problem is it isn't working good
Jun 17 <pedro3005> [21:32:08] look
Jun 17 <pedro3005> [21:32:12] pedro@pedro:~$ ./a.out
Jun 17 <pedro3005> [21:32:13] Here are all of the command-line arguments:
Jun 17 <bgs100> [21:32:23] ...?
Jun 17 <pedro3005> [21:32:29] I didn't feed it any arguments
Jun 17 <pedro3005> [21:32:36] so it should say "no arguments blablabla"
Jun 17 <bgs100> [21:32:43] Oh duh
Jun 17 <bgs100> [21:32:54] pedro3005,
Jun 17 <bgs100> [21:33:00] and seidos
Jun 17 <bgs100> [21:33:07] Change:
Jun 17 <bgs100> [21:33:11] if (argc == 0) {
Jun 17 <bgs100> [21:33:12] to
Jun 17 <seidos> [21:33:12] I'm with you, just following along
Jun 17 <bgs100> [21:33:13] if (argc == 1) {
Jun 17 <bgs100> [21:33:30] And recompile
Jun 17 <pedro3005> [21:33:35] bgs100, wtf, why?
Jun 17 <bgs100> [21:33:38] Because
Jun 17 <bgs100> [21:33:49] The number of arguments will always be at least one
Jun 17 <seidos> [21:33:49] because he's the teacher and he says so?
Jun 17 <bgs100> [21:33:53] For the reason I just said.
Jun 17 <bgs100> [21:34:00] seidos, lol, no
Jun 17 <bgs100> [21:34:14] pedro3005, I just said it, IF YOU WERE PAYING ATTENTION (jk)
Jun 17 <seidos> [21:34:22] what were the arguments again?
Jun 17 <bgs100> [21:34:23] <bgs100> The first element of the argument vector is how the program was called
Jun 17 <bgs100> [21:34:23] <bgs100> If the program let it be displayed (it doesn't),
Jun 17 <bgs100> [21:34:23] <bgs100> it say ./5
Jun 17 <bgs100> [21:34:36] seidos, Run it with no args this time
Jun 17 <bgs100> [21:34:56] pedro3005, Because the argument vector will always have how to program was ran,
Jun 17 <bgs100> [21:35:08] the argument count will always be at least one
Jun 17 <bgs100> [21:35:10] Okay?
Jun 17 <bgs100> [21:35:18] Is your "wtf" satisfied? :p
Jun 17 <seidos> [21:35:30] bgs100, already did, got "there are no command line arguments"
Jun 17 <bgs100> [21:35:39] seidos, Yay, good job
Jun 17 <pedro3005> [21:35:45] ok
Jun 17 <bgs100> [21:35:54] pedro3005, Alright, cool
Jun 17 <seidos> [21:35:59] I still don't get why, and the code looks greek to me
Jun 17 <bgs100> [21:36:04]
Jun 17 <bgs100> [21:36:09] seidos, Okay
Jun 17 <seidos> [21:36:20] I know! let me read it out loud once
Jun 17 <bgs100> [21:36:39] If you give main 2 parameters to take, it will be passed the Argument Count and the Argument Vector
Jun 17 <bgs100> [21:36:50] go ahead, but I'll still explain once more
Jun 17 <seidos> [21:36:59] I don't get what puts does
Jun 17 <seidos> [21:37:03] never heard of puts
Jun 17 <seidos> [21:37:07] I've heard of putts
Jun 17 <seidos> [21:37:11] or putz
Jun 17 <bgs100> [21:37:13] I was about to explain
Jun 17 <seidos> [21:37:13] but not puts
Jun 17 <seidos> [21:37:16] roger
Jun 17 <bgs100> [21:37:33] puts just prints out a string of text and a newline.
Jun 17 <bgs100> [21:37:36] That's it.
Jun 17 <bgs100> [21:38:03] It's useful if you weren't going to do any special formatting stuff with printf and wanted a newline
Jun 17 <bgs100> [21:38:10] IN FACT
Jun 17 <bgs100> [21:38:26] If you say "printf("Hello world\n");",
Jun 17 <bgs100> [21:38:29] when you compile it,
Jun 17 <bgs100> [21:38:39] gcc actually changes it into puts("Hello world");
Jun 17 <bgs100> [21:38:48]
Jun 17 <seidos> [21:38:58] whoa how do you know that?
Jun 17 <seidos> [21:39:08] you know what the compiler is actually doing?
Jun 17 <bgs100> [21:39:18] Here, one sec
Jun 17 <bgs100> [21:41:04] seidos, http://www.ciselant.de/projects/gcc_printf/gcc_printf.html http://nion.modprobe.de/blog/archives/680-gcc-and-printfputs-optimizations.html
Jun 17 <bgs100> [21:41:24] You can check out machine with stuff like gdb and a few other programs
Jun 17 <bgs100> [21:41:29] er
Jun 17 <bgs100> [21:41:33] machine code*
Jun 17 <seidos> [21:42:10] hey cool, a tech blog
Jun 17 <seidos> [21:42:14] I'll add it to my reader
Jun 17 <bgs100> [21:42:25] There's are lots of them
Jun 17 <seidos> [21:42:25] it'll be tough getting into this one
Jun 17 <seidos> [21:42:34] yeah I know
Jun 17 <bgs100> [21:42:38]
Jun 17 <seidos> [21:42:39] lots of blogs, period
Jun 17 <bgs100> [21:42:40] Anyway
Jun 17 <bgs100> [21:42:44] lol
Jun 17 <seidos> [21:42:45] I subscribe to too many as it is
Jun 17 <seidos> [21:42:48] okay, so that's how you know
Jun 17 <seidos> [21:42:52] cool, thanks
Jun 17 <bgs100> [21:43:04] actually
Jun 17 <bgs100> [21:43:12] I read somewhere else and tried it myself
Jun 17 <bgs100> [21:43:18] That was just from a quick google
Jun 17 <bgs100> [21:43:25] ANYWAY
Jun 17 <bgs100> [21:43:30] CONTINUING
Jun 17 <bgs100> [21:43:39] for (i = 1; i < argc; i++)
Jun 17 <bgs100> [21:43:40] printf("%s\n", argv[i]);
Jun 17 <bgs100> [21:43:51] That just prints out all the arguments, except for the first one
Jun 17 <bgs100> [21:43:58] because i starts at 1 instead of 0
Jun 17 <bgs100> [21:45:15] ...okay?
Jun 17 * bgs100 [21:45:21] wonders if pedro3005 is still alive
Jun 17 <bgs100> [21:45:35] ...
Jun 17 <pedro3005> [21:45:44] bgs100, yes
Jun 17 <bgs100> [21:45:47] Good
Jun 17 <bgs100> [21:45:50] And not a zombie?
Jun 17 <pedro3005> [21:45:56] brainsssss
Jun 17 * seidos [21:45:58] is a zombie
Jun 17 <bgs100> [21:46:02] Aw crap
Jun 17 <bgs100> [21:46:07] Zombie processes!
Jun 17 <bgs100> [21:46:12] killall pedro
Jun 17 <bgs100> [21:46:21] $ killal seidos
Jun 17 <bgs100> [21:46:25] $ killall seidos
Jun 17 <bgs100> [21:46:33] Aw crap
Jun 17 <bgs100> [21:46:36] Still alive!
Jun 17 <seidos> [21:46:40] I don't think your knowledge is getting into my brain
Jun 17 <seidos> [21:46:42] hey man
Jun 17 <bgs100> [21:46:42] $ killall -9 pedro
Jun 17 <seidos> [21:46:45] I'm a good zombie
Jun 17 <seidos> [21:46:48] stop trying to kill me
Jun 17 <pedro3005> [21:46:50] bgs100, does that work?
Jun 17 <bgs100> [21:46:52] Lolwut?
Jun 17 <bgs100> [21:46:59] seidos, Good... zombie?
Jun 17 <bgs100> [21:47:02] pedro3005, What?
Jun 17 <seidos> [21:47:03] that's the problem with zombie killers, shoot first ask questions later
Jun 17 <pedro3005> [21:47:09] bgs100, killall -9
Jun 17 <bgs100> [21:47:10] Lol
Jun 17 <bgs100> [21:47:15] pedro3005, Yes, iirc
Jun 17 <pedro3005> [21:47:25] I always forget what iirc is
Jun 17 <seidos> [21:47:33] what is iirc?
Jun 17 <seidos> [21:47:36] in irc?
Jun 17 <pedro3005> [21:47:42] nah
Jun 17 <pedro3005> [21:47:54] if i recall correctly
Jun 17 <bgs100> [21:47:55] pedro3005, If I Recall Correctly
Jun 17 <bgs100> [21:47:59] yeah
Jun 17 <bgs100> [21:48:00] pedro3005,
Jun 17 <bgs100> [21:48:06] from man killall:
Jun 17 <bgs100> [21:48:07] Signals can be specified either by name (e.g. -HUP or -SIGHUP ) or by number (e.g. -1) or by option -s.
Jun 17 <seidos> [21:48:10] I like using pkill -stop, then you can revive him later if you want
Jun 17 <pedro3005> [21:48:23] seidos, hey, did you understand the code?
Jun 17 <bgs100> [21:48:27] seidos, Seriously?
Jun 17 <seidos> [21:48:43] yeah I used pkill -stop firefox
Jun 17 <seidos> [21:48:55] then pkill -cont firefox so that it doesn't use up cpu when I'm not using the computer
Jun 17 <pedro3005> [21:48:59] bgs100, one question though, why char *argv[] and not char argv[]?
Jun 17 <bgs100> [21:49:08] Because
Jun 17 <seidos> [21:49:11] pedro3005, not so much, I'm staring at it though as time permits
Jun 17 <bgs100> [21:49:13] It's an array of strings,
Jun 17 <bgs100> [21:49:16] or another way,
Jun 17 <bgs100> [21:49:22] an array of character pointers
Jun 17 <pedro3005> [21:49:25] ohh
Jun 17 <seidos> [21:49:26] I've always had trouble with loops
Jun 17 <pedro3005> [21:49:26] right
Jun 17 <bgs100> [21:49:33] or an array of character arrays if you like
Jun 17 <seidos> [21:49:37] well, I think I get it, loops aren't that bad, but the syntax is foreign
Jun 17 <pedro3005> [21:49:42] seidos, they're not hard
Jun 17 <seidos> [21:50:10] so i is less than 1 since i is < argc?
Jun 17 <bgs100> [21:50:11] pedro3005, So you have to put the pointer part (*) and the array part ([]) in to signal an array of pointers
Jun 17 <pedro3005> [21:50:14] seidos, the loop will be run while the condition in the middle is true
Jun 17 <seidos> [21:50:26] oh
Jun 17 <pedro3005> [21:50:30] the first sentence is run as the loop starts and the last sentence is run on each iteration
Jun 17 <seidos> [21:50:32] pedro3005, thanks, that clarifies
Jun 17 <bgs100> [21:50:32] seidos, No, i is assigned to 1 at first
Jun 17 <bgs100> [21:50:38] And then what pedro3005 said
Jun 17 <seidos> [21:50:41] so argc is a conditional
Jun 17 <bgs100> [21:50:49] It's a number.
Jun 17 <seidos> [21:50:54] so the for loop is like a while loop?
Jun 17 <bgs100> [21:51:10] A lightly extended while loop, yeah
Jun 17 <seidos> [21:51:18] all right, that makes more sense
Jun 17 <pedro3005> [21:51:19] for (run once; loop condition; run each loop)
Jun 17 <bgs100> [21:51:30] or, more specifically
Jun 17 <bgs100> [21:51:42] or in detail
Jun 17 <seidos> [21:51:47] I don't get how to get the program to do the puts(...
Jun 17 <seidos> [21:51:53] pass any parameter?
Jun 17 <seidos> [21:52:04] at the cli?
Jun 17 <bgs100> [21:52:09] for (run once before the loop starts; loop condition; run after each loop) { body of loop, run each time }
Jun 17 <bgs100> [21:52:22] seidos, ...Which puts?
Jun 17 <seidos> [21:52:48] the puts("Here are all of the command-line arguments:");
Jun 17 <bgs100> [21:53:00] seidos, Yes
Jun 17 <pedro3005> [21:53:01] do something like
Jun 17 <pedro3005> [21:53:06] ./1 arguments go here
Jun 17 <bgs100> [21:53:08] Just give the program some parameters
Jun 17 <bgs100> [21:53:13] ./5*
Jun 17 <pedro3005> [21:53:23] yeah whatever
Jun 17 <pedro3005> [21:53:24] :p
Jun 17 <bgs100> [21:53:29] Lol
Jun 17 <seidos> [21:53:44] I don't get why argc has to be 1 and not 0
Jun 17 <seidos> [21:53:47] 0 is more intuitive
Jun 17 <bgs100> [21:53:51] ...
Jun 17 <bgs100> [21:53:57] Becuase,
Jun 17 <bgs100> [21:54:14] There will *ALWAYS* be at least one argument!
Jun 17 <seidos> [21:54:32] even if you don't type any?
Jun 17 <bgs100> [21:54:40] The first argument is always how the program was ran
Jun 17 <bgs100> [21:54:44] seidos, Yes
Jun 17 <bgs100> [21:54:47] In this case,
Jun 17 <bgs100> [21:54:53] The first argument is "./5"
Jun 17 <seidos> [21:55:03] that's weird
Jun 17 <bgs100> [21:55:20] yeah, somewhat
Jun 17 <seidos> [21:55:59] it's like an argument of itself
Jun 17 <bgs100> [21:56:04] heh, yeah
Jun 17 <seidos> [21:56:06] all right, I think I get it
Jun 17 <bgs100> [21:56:08] Well
Jun 17 <seidos> [21:56:08] basically
Jun 17 <bgs100> [21:56:12] seidos, Here,
Jun 17 <seidos> [21:56:15] I couldn't write it out on my own right now though
Jun 17 <seidos> [21:56:29] without first looking at it
Jun 17 <bgs100> [21:56:29] think of the argument vector as the argument to the *shell*
Jun 17 <seidos> [21:56:45] vector? as in physics?
Jun 17 <bgs100> [21:56:47] or terminal
Jun 17 <bgs100> [21:56:56] seidos, vector as in synonym for array
Jun 17 <seidos> [21:57:26] argument array?
Jun 17 <bgs100> [21:57:35] Yeah, but it's argv, not arga
Jun 17 <seidos> [21:57:37] like the line typed with the arguments?
Jun 17 <bgs100> [21:57:42] yes
Jun 17 <seidos> [21:57:48] ah crap, you're actually talking about the code
Jun 17 <bgs100> [21:57:58] ...
Jun 17 <bgs100> [21:58:06] It's pretty much always called argv
Jun 17 <seidos> [21:58:17] so you're referring to *argv[]
Jun 17 <seidos> [21:58:23] and it's the argument to the shell
Jun 17 <bgs100> [21:58:26] yeah
Jun 17 <bgs100> [21:58:31] arguments
Jun 17 <seidos> [21:58:50] argc is counting the number of arguments
Jun 17 <seidos> [21:58:58] and *argv[] ARE the arguments
Jun 17 <bgs100> [21:59:05] yes
Jun 17 <seidos> [21:59:12] that makes sense
Jun 17 <bgs100> [21:59:18] yeap
Jun 17 <seidos> [21:59:22] int argc is counting the argument intrinsically?
Jun 17 <bgs100> [21:59:23] okay
Jun 17 <bgs100> [21:59:35] seidos, ?
Jun 17 <bgs100> [21:59:39] What do you mean?
Jun 17 <seidos> [21:59:59] all you need is int main(int argc) and you have a counter for your arguments
Jun 17 <pedro3005> [22:00:00] seidos, yes
Jun 17 <bgs100> [22:00:08] Uhhhh
Jun 17 <pedro3005> [22:00:11] I think
Jun 17 <bgs100> [22:00:18] I'll test it.
Jun 17 <seidos> [22:00:32] i mean right after that you have if (argc == 1)
Jun 17 <seidos> [22:00:39] well except int i;
Jun 17 <seidos> [22:00:52] it seems kind of intrinsic to me
Jun 17 <bgs100> [22:01:02] Yes
Jun 17 <bgs100> [22:01:11] seidos, ???
Jun 17 <bgs100> [22:01:19] What do you mean by intrinsic?
Jun 17 <seidos> [22:01:28] like, it just is
Jun 17 <seidos> [22:01:34] you don't have to build a counter
Jun 17 <bgs100> [22:01:38] Yes
Jun 17 <bgs100> [22:01:44] You couldn't build a counter
Jun 17 <seidos> [22:01:46] for some reason, at a low level I guess, int argc is counting
Jun 17 <pedro3005> [22:01:50] bgs100, intrinsic is inherent, which is present in its own essence
Jun 17 <bgs100> [22:02:04] pedro3005, Ah, thank you...
Jun 17 <pedro3005> [22:02:08] evil is intrinsic to the human spirit
Jun 17 <pedro3005> [22:02:10]
Jun 17 <bgs100> [22:02:17] Heh
Jun 17 * bgs100 [22:02:33] gives pedro3005 the Dictionary badge
Jun 17 <seidos> [22:02:37] pedro3005, You fool! If that were true then Jesus would've been evil, since he was human!
Jun 17 <seidos> [22:02:45] heh heh
Jun 17 <bgs100> [22:02:49] Lol
Jun 17 <pedro3005> [22:03:01] back to C
Jun 17 <seidos> [22:03:07] I couldn't have defined it better, and I used the word
Jun 17 <bgs100> [22:03:10] IT'S A CONSPIRACY
Jun 17 <seidos> [22:03:13] yes
Jun 17 <bgs100> [22:03:14] Wait a second....
Jun 17 <seidos> [22:03:17] back to C
Jun 17 <bgs100> [22:03:21] JESUS MUST HAVE CAUSED 9/11!!!
Jun 17 <bgs100> [22:03:25] :P
Jun 17 <bgs100> [22:03:30] Yeah, back to C
Jun 17 * seidos [22:03:46] restrains himself from saying anything
Jun 17 <bgs100> [22:03:51] lol
Jun 17 * bgs100 [22:04:01] hands seidos duct tape
Jun 17 <seidos> [22:04:11] I think I get it
Jun 17 <seidos> [22:04:15] finally
Jun 17 <seidos> [22:04:21] still couldn't type it out from scratch though
Jun 17 <seidos> [22:04:25] not sure how long that would take
Jun 17 <seidos> [22:04:35] you know, I get the sense that I'm like actually learning a language
Jun 17 <seidos> [22:04:39] like Tibetan
Jun 17 <bgs100> [22:04:45] Heh
Jun 17 <seidos> [22:04:51] it's a pain in the ass
Jun 17 <bgs100> [22:04:57] Well, good that you get the sense that you're learning
Jun 17 <seidos> [22:04:58] well...maybe not that bad
Jun 17 <bgs100> [22:04:58] LOL
Jun 17 <seidos> [22:05:13] I wish I could just download it into my brain
Jun 17 <bgs100> [22:05:18] ...
Jun 17 * bgs100 [22:05:25] plugs seidos up to the Matrix
Jun 17 <seidos> [22:05:29] I have to ask, is this the most efficient way to get what's in your brain into my own?
Jun 17 <bgs100> [22:05:46] That's very, very doubtful.
Jun 17 <pedro3005> [22:05:47] there's the zombie way
Jun 17 <pedro3005> [22:05:54] eat tiny bits of his brain daily
Jun 17 <bgs100> [22:05:55] But it's the best we have so far, methinks
Jun 17 <bgs100> [22:06:00] pedro3005, xD
Jun 17 <seidos> [22:06:06] maybe I should make some subliminal tapes on C
Jun 17 <bgs100> [22:06:11] lol
Jun 17 <bgs100> [22:06:22] pedro3005, But then I lose it
Jun 17 <seidos> [22:06:29] it might work
Jun 17 <seidos> [22:06:36] the subliminal tapes of course
Jun 17 <pedro3005> [22:06:38] seidos, the key is in practice
Jun 17 <pedro3005> [22:06:44] bgs100, assign homework :P
Jun 17 <bgs100> [22:06:50] Lol, okay
Jun 17 <seidos> [22:06:50] pedro3005, genetics help too, from what I hear
Jun 17 <bgs100> [22:06:56] hmm
Jun 17 <seidos> [22:06:59] yeah, I could probably use some homework
Jun 17 <seidos> [22:07:07] I need homework, and a grand sweeping project
Jun 17 <bgs100> [22:07:16] I will teach you one more thing, and then give you homework
Jun 17 <seidos> [22:07:25] like a web app that I have no hope of doing on my own without coming here regularly and learning bits and pieces
Jun 17 <bgs100> [22:07:40] Time to learn about.......................................................................................................................................................................SCANF()!!!!!!!!!!
Jun 17 <seidos> [22:07:43] all right
Jun 17 <pedro3005> [22:07:49] bgs100, oh that fucks me up
Jun 17 <bgs100> [22:07:59] Lol
Jun 17 <pedro3005> [22:08:00] It just doesn't god damn work
Jun 17 <bgs100> [22:08:07] Well fix you up :p
Jun 17 <seidos> [22:08:10] I'm going to call the file scanf.c
Jun 17 <bgs100> [22:08:19] seidos, okay
Jun 17 <seidos> [22:08:25] that way if I'm programming some day and I'm like "wtf is scanf again" I can look it up
Jun 17 <pedro3005> [22:08:26] well go ahead and teach
Jun 17 <bgs100> [22:08:31] Okay
Jun 17 <bgs100> [22:08:42] scanf() is a nice quick-and-dirt input function.
Jun 17 <bgs100> [22:08:55] It does lots of work for you, but it easy for the user to break.
Jun 17 <bgs100> [22:09:02] is*
Jun 17 <pedro3005> [22:09:23] damn users
Jun 17 <bgs100> [22:09:25] but oh well, who cares about users right now
Jun 17 <bgs100> [22:09:29] lol pedro3005
Jun 17 * bgs100 [22:09:41] gives pedro3005 the Potty Mouth badge
Jun 17 <seidos> [22:09:44] I want to write a program that predicts the next Great Depression
Jun 17 <bgs100> [22:09:45] :p
Jun 17 <bgs100> [22:09:54] seidos, Not quite there yet.
Jun 17 <bgs100> [22:10:02] Also that needs lots of Economics Maths
Jun 17 <pedro3005> [22:10:06] seidos, look up rand()
Jun 17 <bgs100> [22:10:06] and magic
Jun 17 <pedro3005> [22:10:08] :P
Jun 17 <bgs100> [22:10:10] LOL
Jun 17 <seidos> [22:10:13] just inputs right?
Jun 17 <seidos> [22:10:22] we can discuss it after the lesson
Jun 17 <bgs100> [22:10:23] ?
Jun 17 <bgs100> [22:10:27] yeah
Jun 17 <bgs100> [22:10:29] Okay, scanf
Jun 17 <bgs100> [22:10:37] I'll write a sample program
Jun 17 <pedro3005> [22:10:48] k
Jun 17 <bgs100> [22:14:22] http://pastebin.com/A8GU61ix
Jun 17 <bgs100> [22:14:33] seidos, pedro3005 Copy and SCRO
Jun 17 <pedro3005> [22:15:19] bgs100, ...
Jun 17 <seidos> [22:15:31] kevin@kevin-laptop:~/programs/c/irc-class$ ./scanf
Jun 17 <seidos> [22:15:32] Type in a number: 3
Jun 17 <seidos> [22:15:32] Type in a another number: 2
Jun 17 <seidos> [22:15:32] You're number multiplied together are 6, yay for math.
Jun 17 <pedro3005> [22:15:34] we're gonna have to include Grammar classes in this channel
Jun 17 <bgs100> [22:15:46] ???
Jun 17 <bgs100> [22:15:47] What
Jun 17 <bgs100> [22:15:51] is wrong?
Jun 17 <pedro3005> [22:15:58] You're number multiplied together are 6, yay for math.
Jun 17 <bgs100> [22:16:05] oh'
Jun 17 <bgs100> [22:16:05] typo
Jun 17 <pedro3005> [22:16:14] Your numbers multiplied result in 6
Jun 17 <bgs100> [22:16:15] pedro3005, fix it and be happy
Jun 17 <pedro3005> [22:16:17] :P
Jun 17 <pedro3005> [22:16:24] bgs100, go on
Jun 17 <bgs100> [22:16:38] "together are" is fine, Thank You Very Much >:|
Jun 17 <bgs100> [22:16:43] (jk)
Jun 17 <bgs100> [22:16:46] Okay
Jun 17 <bgs100> [22:16:56] Can either of you tell me how scanf works?
Jun 17 <bgs100> [22:17:12] pedro3005, seidos ?
Jun 17 <seidos> [22:17:15] yeah, you know, you type in a number
Jun 17 <seidos> [22:17:19] and it takes it
Jun 17 <bgs100> [22:17:19] No
Jun 17 <pedro3005> [22:17:21] it's like the opposite of printf
Jun 17 <seidos> [22:17:22] and you can do stuff to it
Jun 17 <bgs100> [22:17:24] How does it work on the inside?
Jun 17 <pedro3005> [22:17:35] getchar() ?
Jun 17 <seidos> [22:17:38] I dunno, I haven't even read the code yet :|
Jun 17 <bgs100> [22:17:41] Well
Jun 17 <bgs100> [22:17:50] It runs on pure magic, quite simply
Jun 17 <pedro3005> [22:17:56] it waits for a \n then breaks
Jun 17 <bgs100> [22:18:02] No
Jun 17 <pedro3005> [22:18:03] or EOF
Jun 17 <bgs100> [22:18:05] Here:
Jun 17 <bgs100> [22:18:07] Seriously,
Jun 17 <bgs100> [22:18:25] what it does (not how it works, that was a joke),
Jun 17 <bgs100> [22:18:47] is go through user input looking for the pattern that you described to it
Jun 17 <pedro3005> [22:19:00] pedro@pedro:~$ ./a.out
Jun 17 <pedro3005> [22:19:00] Type in a number: a
Jun 17 <pedro3005> [22:19:00] Type in a another number: You're number multiplied together are -1068067396, yay for math.
Jun 17 <bgs100> [22:19:08] Yeah
Jun 17 <seidos> [22:19:09] scanf is doing the multiplying?
Jun 17 <bgs100> [22:19:11] Don't do that.
Jun 17 <bgs100> [22:19:14] seidos, NO
Jun 17 <bgs100> [22:19:16] nononoo
Jun 17 <seidos> [22:19:25] I don't see where the multiplying is done
Jun 17 <pedro3005> [22:19:32] num1 * num2
Jun 17 <seidos> [22:19:33] nevermind
Jun 17 <seidos> [22:19:33] see it now
Jun 17 <bgs100> [22:19:52] continuing, And then it reads in the format things ( like %d) into the variable addresses you provide.
Jun 17 <pedro3005> [22:20:01] bgs100, sometimes they use scanf like scanf("[shit and stuff here]")
Jun 17 <pedro3005> [22:20:04] you know?
Jun 17 <pedro3005> [22:20:09] what's that?
Jun 17 <bgs100> [22:20:12] ...?
Jun 17 <seidos> [22:20:16] it was all that "magic" talk
Jun 17 <bgs100> [22:20:19] What do you mean?
Jun 17 <pedro3005> [22:20:19] with brackets in it
Jun 17 <bgs100> [22:20:35] ...do you have an example?
Jun 17 <pedro3005> [22:20:43] I used to :p
Jun 17 * bgs100 [22:20:48] has never seen it done with brackets...
Jun 17 <bgs100> [22:20:52] well whatever
Jun 17 <bgs100> [22:21:11] So, now you guys know how to get numbers as input.
Jun 17 <seidos> [22:21:14] pedro3005, you don't have a sample file with in it inside?
Jun 17 <seidos> [22:21:17] yeah scanf
Jun 17 <bgs100> [22:21:17] Right?
Jun 17 <seidos> [22:21:19] got it
Jun 17 <pedro3005> [22:21:45] seidos, yeah nvm me, I'm crazy
Jun 17 <bgs100> [22:21:46] seidos, And you need a variable to put the number into, and then you give to scanf with & in front of it's name (to get the address).
Jun 17 <bgs100> [22:21:49] So
Jun 17 <bgs100> [22:21:55] Are you ready for homework?
Jun 17 <pedro3005> [22:22:04] Yes, Mr. bgs100
Jun 17 <bgs100> [22:22:27] pedro3005, You can call me Bgs or 100, it's fine
Jun 17 <bgs100> [22:22:39] Your homework is to:
Jun 17 <bgs100> [22:22:51] Write a program that has a secret number,
Jun 17 <bgs100> [22:23:10] and repeatedly asks the user for the number until they get it
Jun 17 <bgs100> [22:23:19] For bonus points,
Jun 17 <bgs100> [22:23:30] Tell the user whether they are two high or two low.
Jun 17 <pedro3005> [22:23:31] ohhh number guessing game
Jun 17 <bgs100> [22:23:36] pedro3005, Yep.
Jun 17 <seidos> [22:23:43] this hw is too easy for pedro3005
Jun 17 <pedro3005> [22:23:45] I'll work on it
Jun 17 <seidos> [22:23:49] he's done a number guessing game already
Jun 17 <bgs100> [22:23:52] Next lesson we'll be going into random numbers
Jun 17 <pedro3005> [22:23:54] in Python
Jun 17 <seidos> [22:23:59] it's diabolical torture for me, however
Jun 17 <pedro3005> [22:24:00] but python is like cheating
Jun 17 <bgs100> [22:24:07] Yeah
Jun 17 <bgs100> [22:24:11] You have to do it in C
Jun 17 <bgs100> [22:24:22] seidos, The bonus *is* optional.
Jun 17 <bgs100> [22:24:24] :p
Jun 17 <seidos> [22:24:33] oh shoot me
Jun 17 <pedro3005> [22:24:38] bgs100, well, this game kind of begs for rand()
Jun 17 <bgs100> [22:24:47] pedro3005, That will be next leson
Jun 17 <bgs100> [22:24:50] lesson*
Jun 17 <bgs100> [22:25:01] After you have submitted your homework
Jun 17 <pedro3005> [22:25:15] ok, I'll do it by the rules
Jun 17 <pedro3005> [22:25:16] xD
Jun 17 <bgs100> [22:25:19] I will modify it with rand() and we will be learning about that.
Jun 17 <pedro3005> [22:25:33] ohh, idea
Jun 17 <bgs100> [22:25:48] pedro3005, No skipping ahead of material just because you know more >:{
Jun 17 <seidos> [22:26:12] hey, don't try to stunt his development
Jun 17 <bgs100> [22:26:18] lol
Jun 17 <bgs100> [22:26:26] pedro3005, What idea?
Jun 17 <seidos> [22:26:57] oh yeah, and what about my Great Depression calculator
Jun 17 <bgs100> [22:27:21] seidos, He already knows about rand() so it's not so much developemt ;p
Jun 17 <bgs100> [22:27:23] Also
Jun 17 <bgs100> [22:27:30] I know extremely little about economics
Jun 17 <bgs100> [22:27:41] development*
Jun 17 <seidos> [22:27:45] I have a bachelors in business
Jun 17 <pedro3005> [22:27:46] bgs100, I'm not gonna use rand
Jun 17 <seidos> [22:27:48] that's something
Jun 17 <bgs100> [22:27:52] Ah
Jun 17 <seidos> [22:27:57] not much, but it's something
Jun 17 <bgs100> [22:27:58] pedro3005, k
Jun 17 <bgs100> [22:28:05] seidos, More than me, lol
Jun 17 <seidos> [22:28:14] there is no existing great depression calculator
Jun 17 <pedro3005> [22:28:15] bgs100, a question though, like, to grab the value of something, which symbol is it?
Jun 17 <seidos> [22:28:17] just tried googling
Jun 17 <pedro3005> [22:28:24] &?
Jun 17 <pedro3005> [22:28:28] *?
Jun 17 <bgs100> [22:28:32] To grap the address, yes
Jun 17 <pedro3005> [22:28:40] not the address
Jun 17 <pedro3005> [22:28:41] the value
Jun 17 <bgs100> [22:28:45] The get the value at the address, *
Jun 17 <pedro3005> [22:28:50] ok thanks
Jun 17 <bgs100> [22:28:56] in front of the address
Jun 17 <bgs100> [22:28:58] np
Jun 17 <pedro3005> [22:29:17] I'm getting "Segmentation Fault"
Jun 17 <pedro3005> [22:29:21]
Jun 17 <bgs100> [22:29:45] ...
Jun 17 <bgs100> [22:29:49] Geez, you do move fast
Jun 17 <seidos> [22:29:57] according to this article http://economics.about.com/cs/businesscycles/a/depressions.htm there is no single definition for a depression
Jun 17 <bgs100> [22:30:10] pedro3005, PM the pastebined code?
Jun 17 <seidos> [22:30:12] I'd have to pick one
Jun 17 <bgs100> [22:30:15] seidos, hm
Jun 17 <seidos> [22:30:35] I have two lines on my HW
Jun 17 <pedro3005> [22:30:40] bgs100, can you give me the pastebin of program 5 again? I lost it
Jun 17 <seidos> [22:30:41] pedro3005, are you working on your HW?
Jun 17 <pedro3005> [22:30:47] seidos, yeah
Jun 17 <bgs100> [22:31:01] pedro3005, Did you not save it? >_>
Jun 17 * pedro3005 [22:31:08] blushes
Jun 17 <seidos> [22:31:22] do we give the user a range to guess within?
Jun 17 <bgs100> [22:31:45] If you want
Jun 17 <bgs100> [22:31:49] optional
Jun 17 <pedro3005> [22:32:02] bgs100, so... do you have it?
Jun 17 <bgs100> [22:32:18] ...I would have my own code *rolls eyes*
Jun 17 <pedro3005> [22:32:24]
Jun 17 <seidos> [22:32:30] I have it
Jun 17 <pedro3005> [22:32:45] well, can someone paste it?
Jun 17 <bgs100> [22:32:57] pedro3005, http://pastebin.com/fazfyKeV
Jun 17 <pedro3005> [22:32:59] especially since I need to leave in half an hour
Jun 17 <seidos> [22:33:12] weird it has "KeV" in it
Jun 17 * bgs100 [22:33:13] gives seidos The Good Student badge
Jun 17 <bgs100> [22:33:19] lolwut
Jun 17 <bgs100> [22:33:24] Oh
Jun 17 <bgs100> [22:33:26] The URL
Jun 17 <seidos> [22:33:27] the pastebin
Jun 17 <seidos> [22:33:30] yeah URL
Jun 17 <bgs100> [22:33:35] seidos, Ha.
Jun 17 <bgs100> [22:33:36] ...
Jun 17 <seidos> [22:33:36] is that 5?
Jun 17 <bgs100> [22:33:40] Or should I say...
Jun 17 <bgs100> [22:33:43] KEVIN?!
Jun 17 <bgs100> [22:33:47] seidos, Yeah
Jun 17 <seidos> [22:33:48] haha
Jun 17 <bgs100> [22:34:27] It seems a bit odd if someone ever uses my real name in IRC
Jun 17 <seidos> [22:34:54] I used to come online with my real name
Jun 17 <seidos> [22:35:03] then I was getting too paranoid about it, so I stopped
Jun 17 <bgs100> [22:35:08] I never did.
Jun 17 * pedro3005 [22:35:14] slaps C
Jun 17 <pedro3005> [22:35:20] Work, dammit!
Jun 17 <bgs100> [22:35:32] pedro3005, C is made of iron, your slap had no effect
Jun 17 * seidos [22:35:51] sacrifices a small animal to the C gods
Jun 17 <bgs100> [22:36:01] seidos, Small?!
Jun 17 * seidos [22:36:03] prays his warnings and errors to go away
Jun 17 <bgs100> [22:36:17] You think they want like a rabbit or something?
Jun 17 <seidos> [22:36:19] there are no big animals handy
Jun 17 <bgs100> [22:36:32] <look of disapproval>
Jun 17 <seidos> [22:36:32] I'd sacrifice myself, but then I would get nowhere
Jun 17 <bgs100> [22:36:48] seidos, You can do it without dying...
Jun 17 <pedro3005> [22:37:16] bgs100, I kinda need convert char to int :p
Jun 17 <bgs100> [22:37:20] All you have to do is throw yourself into malloc, realloc, calloc, free, segfault and memory hell.
Jun 17 <bgs100> [22:37:38] Probably worse than death anyhow
Jun 17 <bgs100> [22:37:42] pedro3005, ...
Jun 17 <bgs100> [22:37:50] pedro3005, ............why
Jun 17 <pedro3005> [22:37:57] don't ask why
Jun 17 <bgs100> [22:37:59] pedro3005, PM me with details
Jun 17 <pedro3005> [22:38:03] is it feasible?
Jun 17 <bgs100> [22:38:04] Or a code pastebin
Jun 17 <bgs100> [22:38:11] pedro3005, Of course...
Jun 17 <pedro3005> [22:38:21] how?
Jun 17 <bgs100> [22:38:25] There's a standard function for it.
Jun 17 <pedro3005> [22:38:29] oh cool
Jun 17 <bgs100> [22:38:35] One sec
Jun 17 <pedro3005> [22:38:39] int()?
Jun 17 <seidos> [22:38:50] dang I put stdio.c and not stdio.h
Jun 17 <bgs100> [22:39:12] pedro3005, This isn't python.
Jun 17 <bgs100> [22:39:19] :p
Jun 17 <pedro3005> [22:39:23] I know, I know, sorry
Jun 17 <bgs100> [22:39:30]
Jun 17 <pedro3005> [22:39:34] if it was I'd be done
Jun 17 <pedro3005> [22:39:35] :p
Jun 17 <bgs100> [22:40:24] sec
Jun 17 <seidos> [22:40:25] I forgot 99% of python
Jun 17 <seidos> [22:40:29] I'd still be struggling
Jun 17 <bgs100> [22:41:50] pedro3005, Just use (int)(yourcharacter - '0')
Jun 17 <bgs100> [22:42:20] If the character represents an integer, that should work with ASCII
Jun 17 <bgs100> [22:42:34] (and unicode)
Jun 17 <bgs100> [22:43:53] pedro3005, okay?
Jun 17 <pedro3005> [22:44:02] bgs100, see pm?
Jun 17 <seidos> [22:44:29] I got a bunch of warrnings and errors, but I don't think I got a realloc, calloc, free or segfault
Jun 17 <seidos> [22:44:44] am I in these hells and don't realize it?
Jun 17 <bgs100> [22:46:35] ...no
Jun 17 <bgs100> [22:46:42] You very very veyr ceryainly should not be
Jun 17 <bgs100> [22:46:50] Uh
Jun 17 <bgs100> [22:46:53] very certainly*
Jun 17 <bgs100> [22:50:44] ALSO
Jun 17 <bgs100> [22:50:47] pedro3005, seidos
Jun 17 <seidos> [22:50:59] here
Jun 17 <bgs100> [22:51:10] I would prefer if the number at least could be 2 digit.
Jun 17 <bgs100> [22:51:24] Also, do both of you have manpages-dev installed?
Jun 17 * seidos [22:51:35] isn't sure
Jun 17 <seidos> [22:52:04] I'm installing now
Jun 17 <bgs100> [22:52:25] Okay
Jun 17 <bgs100> [22:52:27] pedro3005, do you?
Jun 17 <seidos> [22:52:31] weird it didn't ask me to confirm
Jun 17 <pedro3005> [22:52:31] yes
Jun 17 <bgs100> [22:52:45] seidos, With small packages it often doesn't
Jun 17 <bgs100> [22:52:48] Okay
Jun 17 <seidos> [22:52:50] I can't even get my program to compile for a single digit number
Jun 17 <bgs100> [22:52:55] run the command:
Jun 17 <bgs100> [22:52:59] man sscanf
Jun 17 <bgs100> [22:53:09] Just in case you want to do anything special
Jun 17 <bgs100> [22:53:23] seidos, PM Pastebind code?
Jun 17 * bgs100 [22:54:28] waits for reponse
Jun 17 <seidos> [22:54:36] sorry it took so long
Jun 17 <seidos> [22:54:54] if it looks bad now, I actually worked on it to improve it :|
Jun 17 <pedro3005> [22:59:36] bgs100, done
Jun 17 <seidos> [23:00:02] all right, only one warning now
Jun 17 <bgs100> [23:00:16] :|
Jun 17 <bgs100> [23:00:22] pedro3005, PM me code
Jun 17 <bgs100> [23:02:20] Okay
Jun 17 <pedro3005> [23:03:28] bgs100, give an assignment that uses structs
Jun 17 <bgs100> [23:04:15] Style/Format: Good, could use a little work.
Jun 17 <bgs100> [23:04:22] (grading pedro's first submission)
Jun 17 <bgs100> [23:04:48] Meets specifications: Yes, including the bonus
Jun 17 <bgs100> [23:05:27] Other: Eh, there was a missing return and unnecessary variable
Jun 17 <bgs100> [23:05:38] Overall grade: A-/A
Jun 17 <pedro3005> [23:05:40] who gives a damn about returns
Jun 17 <pedro3005> [23:05:43] :P
Jun 17 <bgs100> [23:05:44] ...
Jun 17 <bgs100> [23:05:45] I DO
Jun 17 <seidos> [23:05:55] when's the deadline?
Jun 17 * bgs100 [23:05:58] smites pedro3005 with lightning
Jun 17 <pedro3005> [23:06:01] guess I'll work on an AI for it tomorrow
Jun 17 <pedro3005> [23:06:04] bed time for me now
Jun 17 <bgs100> [23:06:08] seidos, Next lesson
Jun 17 <bgs100> [23:06:12] AI?
Jun 17 <bgs100> [23:06:15] pedro3005, Night
Jun 17 <seidos> [23:06:20] night pedro3005
Jun 17 <pedro3005> [23:06:22] bgs100, yeah so the computer guesses your number
Jun 17 <pedro3005> [23:06:29] and not the oh-so-boring inverse
Jun 17 <pedro3005> [23:06:43]
Jun 17 <pedro3005> [23:06:51] thanks for the lesson bgs100
Jun 17 <bgs100> [23:06:53] Lol, logival steps make that pretty easy, but yeah
Jun 17 <bgs100> [23:06:58] pedro3005, np, I had fun
Jun 17 <bgs100> [23:07:06] Hopefully you did too
Jun 17 <bgs100> [23:08:25] ==========================LESSON OFFICIALLY TOTALLY OVER=========================
Jun 17 <bgs100> [23:08:27] OH CRAP
Jun 17 <bgs100> [23:08:37] seidos, Do you have the logs for this lesson?
Jun 17 <seidos> [23:08:50] no, but I went back and read everything already
Jun 17 <bgs100> [23:09:00] I mean for the channel
Jun 17 <bgs100> [23:09:12] mohi2911 likes logs of the classes
Jun 17 <bgs100> [23:09:21] And agreed, they are important
Jun 17 <bgs100> [23:09:30] So those who weren't present can benefit
Jun 17 <bgs100> [23:09:37] Hm
Jun 17 <seidos> [23:28:38] I've read logs from this channel before
Jun 17 <seidos> [23:28:41] bgs100
Jun 17 <seidos> [23:28:44] aren't they on the web?
Jun 17 <bgs100> [23:29:00] Somehow has to upload them...
Jun 17 <bgs100> [23:29:04] Someone*
Jun 17 <seidos> [23:29:09] ah
Jun 17 <bgs100> [23:29:10] Also, idk
Jun 17 <bgs100> [23:29:24] And to upload 'em someone has to have them...
Jun 17 <seidos> [23:29:35] I think I might have them
Jun 17 <seidos> [23:30:23] hmmm I can't find the xchat folder
Jun 17 <seidos> [23:30:44] ah there it is
Jun 17 <seidos> [23:31:10] I have logs back to feb 17
Jun 17 <seidos> [23:31:11]
Jun 17 <seidos> [23:32:19] bgs100
Jun 17 <bgs100> [23:32:38] Lol okay
Jun 17 <seidos> [23:33:32] do you need me to paste what I have for today somewhere?
Jun 17 <bgs100> [23:35:04] No
Jun 17 <bgs100> [23:35:10] mohi2911 will want itlater
Jun 17 <bgs100> [23:35:14] it later*
Jun 17 <seidos> [23:35:30] all right
Jun 17 <bgs100> [23:37:22] Night
learners/17062010 (last edited 2010-06-27 14:27:59 by 117)