Darmalus wrote:Sorry if I'm getting this across poorly. This would be entirely for personal projects, my major doesn't have a lot of programming in it, just enough to make me interested. When it comes to programming, my mind is basically an empty vessel at this point.
Right now, my sights aren't set any higher than, say, a rogue-like or Dwarf Fortress. I guess that would be math heavy.
Personally, I won't recommend a specific language, but instead I'll recommend that you come up with some projects or tasks to do. They could be a series of exercises from the programming book for whichever language you decide upon, or things you dream up in your head.
In my experience, programming languages are
tools just like anything else you might find in a garage. Woodworking tools shape and transform wood, and computer code shapes and transforms information. Implicit in defining code as a tool is that it needs to perform a role in creating or doing something, no matter if your goal is "build a bed" or "build a game." Does this mean you should have a 'driving ambition to build this next great game?'
No. I really like that you're interested in programming. I love the process of programming, myself, and the kind of thinking you have to do to proceduralize an abstract concept into lines of deliberate, logical code. But you have to ride a bike to learn how to do so, and that means travelling somewhere with it.
My own introduction to programming was by making simple programs and games on my TI-83+ in high school. Some of them were simple little math things like adding up the numbers from 1 to 100 to double-check that I have the generalized formula working right. I wrote a program to do synthetic polynomial division (which meant that I forgot how to do it in the final exam). I also wrote a 2-player Tron light-cycle type game, and a single-player racetrack type game, and a very limited MUD-style fighting game against a dimwitted AI. Over my undergraduate degree as a geomatics engineer, I've had dozens and dozens of programming assignments that were "use C++ to use a least-squares adjustment to perform a GPS positioning solution" or "use c++ to use a least-squares adjustment to perform a photogrammetric intersection" or "use any language of your choice (which means I get to use matlab
) to do this other assignment," or "use VBA to write an ArcMap program to do this"... and now it's "use C# to write an embedded application to position and navigate and fly a small UAV"
So do the examples in the textbook or programming book. Look online for coding challenges and try them out. Come up with your own ideas for simple, little programs, or medium-sized programs. Buy a
netduino and some extra attachments from
Sparkfun and try to build something neat. The process of writing code
to solve a problem is what I love about programming, and I think the best way to learn programming is, well, writing code to solve problems.
Darmalus wrote:Brother-Captain Gaius wrote:Pointers still gives me trouble.
Exactly what I'm talking about ITT. To understand linked lists, you need to understand pointers.
I want to understand pointers (really want to, finals are next week). I think my problem is that, so far, nothing has been done to differentiate a pointer from a normal variable (know what it does, but how does that do anything but add an extra step?). I can probably muddle through that part of the test by rote, but actually knowing what I'm doing is always better.
http://www.cplusplus.com has the same problem as my class notes and textbook, it looks like they are using pointers like a regular variable.
In some way of looking at it, pointers really are just "adding an extra step." They still have a value stored, in them, which is just the address of the variable they're targeting.
You can very easily see what a pointer looks like. I'm probably doing this wrong (and I'm supposed to be doing other homework right now), but I think you can basically
Code: Select all
int num = 1234; /*simple variable to point to */
int *c; /*our pointer*/
c = #
printf("%d \n",c);
and you should see some odd number. (You could also see the number in hexadecimal by using "%x" or "%X" but that doesn't matter.) Whenever you use a pointer, the compiled code knows how to use that odd number as a memory address.
Pointers come in handy when you're iterating through arrays, but you have to keep in mind that the type of pointer depends on the target data type. A char and int have different sizes, so an increment operator on a char pointer only increments the memory address it points to by the size of a char (1 byte), rather than the size of a bit (4 or 8 bytes). Again, to see it in action, printf() the pointer and see how it changes in a loop incrementing or decrementing it.
Maybe a way to think of it is with the idea of a bunch of mailboxes in the wall, like you get at an apartment building. Different mailboxes can store different things (like only a letter, or a big parcel), and you can refer to a mailbox by name ("Bill's mailbox") or by address (which is what a pointer does). The advantage of a pointer is that it lets you iterate through variables in an array, just like if you were putting a flyer in every tenant's mailbox. You just iterate the pointer up and down, so it basically turns into "Mailbox 44, mailbox 45, mailbox 46, etc". The type of a pointer matters because different data types have different sizes because of how they're stored in memory. You can have an array of chars or ints or even an array of complex data types like a struct of your own definition, which like is the difference between a row of mailboxes and a row of houses.