Updates

Long work weeks.

Last week I worked out of town all week. This week I’ll be pulling a two week straight stint. Then I have drill. Then another week. Ugh, it goes and goes.

On an upnote, I’ve been pretty good about getting up and studying. Lately though I havent produced much because I’ve been watching a lot of lectures. So now I’m tacking problem set 2.

The first program was a simple one that required me to print on the screen all the lyrics to “This Old Man.” 

This old man, he played one
He played knick-knack on his thumb

and so on. Its nothing special but its meant to be a first go around in using arrays. The awesome part about this program is that it complied and worked on my first attempt. Woo! I just had to add a few \n to make it format properly.

The other problems have me creating a Cesar Cypher. I have yet to really get this one down on account that I’m a little foggy on a few points.

– how to convert a char to a corrosponding ASCII int. From what I understand, you can typecast it and it’ll do the legwork. 

– from there I want/need to know how to initialize an array thats empty waiting to be filled. Can I even do that in C or do I have to know its size ahead of time? 

The next problem set calls for a Vigenere Cypher. For the uninitiated, its similar to a Cesar Cypher but instead of a single number shift it uses a shift word. Each word has a corresponding number and the words are shifted according to that number. Since I havent worked through the Cesar Cypher I havent applied much thought to this problem yet. 

So thats that for now 🙂

Advertisements
Standard

2 thoughts on “Long work weeks.

  1. If you know the size of the array to initialize, use memset. If you are creating the array dynamically (i.e. you don’t know the size at compile time), you would use malloc to create the array to whatever size you need, then memset to the size you create, then be sure to free the memory that you malloc’d.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s