≡ Menu

A Lab I don’t want to attend

Science is something I generally find fun. I think it’s pretty cool what you can do with electricity and a few transistors that cause a calculator to work. I think it’s pretty cool to know that if I drop a bowling ball and a ping pong ball from a tall building, both will hit you in the head at the same time. It’s all very useful information. However, there are two things I don’t like about science, or at least the school systems version of science. They train you do to lab books, they train you to do lab books a certain way. Now, I understand the need to document what your doing. Why do you think I have this site? I know you need to remember how to reproduce it. But really, why do I have to answer the same question 3 times for their needs to be satisfied. I suppose the reason is, this is college, get over it. So thats what I am doing. I am doing a lab manual. At least we know that when it’s all said and done, I will have a good understanding of gravity and how to write books to make people happy.

At the same time I thought I would show you the other side of my schooling: The programming. I don’t have that much time until lab, but here goes your first lesson in C. I believe the best way to learn C is to look at C code, so we are going to go through this program line by line so as never to forget it.

#include

main()
{
printf(“Hello,JJ’s World!\n”);
return 0;
}

Now I fear part of that may have been lost to the formatting of html… Imparticularly the include line… But, I’ll fix it later… Let’s look at it line by line now…
#include : This line includes a well known, very basic, standard input and output class. In other words, it allows us to use fuctions like printf() which we will see in just a minute.
main{: is the primary and opening function executed by C. It is required for all C programs as an entry point for the compiler to come into. In other words, this is the starting point of all programs.

printf(“Hello,JJ’s World!\n”);This line as you probably have already guessed prints text to the screen. The \n is the character to mark a new line. There are some other tricks to this function that I don’t want to get into right now. The ; at the end of the statement is just that, a marker for the end of statements.
return 0; this is the standard return to the operating system to let it know that the program finished ok. If you returned anything else, there’s a chance that the OS would think the program crashed or failed to really end, for it has no clue what to do with a 1 if the program sends it a 1. In other words, this just lets the OS know we are done.
} closes main.
Now wasnt that simple?

Ok, screw that. I have to get to lab and then come back here to play a game of chess with John. I am sure I will probably try to post then as well. I will be missing computer club today which is a little annoying, but on the upside, there might be enough snow to go sledding here shortly. Still don’t know if I am going to see formentioned one-act play.

Outie!

Next post:

Previous post: