Programming in C

Note: This article was published while I was in my early 20s. I was much younger and dumber. Please don't hold it against me. One of the perils of having a 20+ year old website!

This semester I am taking a class where it was recently decided the primary language will be C. While I did dabble in C a little bit last semester, I didn’t do all that much. This evening I did our first assignment, which was a simple “Hello World” program in C, programmed on a UNIX machine I telneted into. Here is my slightly more complicated program and some explanation:

C

While I would be able to achieve this by printing printf("Hello World");, I wanted to illustrate character arrays and pointers in my program. I stored the string “Hello World” in a character array, because C does have a String object, or any objects for that matter. This will probably be the hardest thing for me to adjust to in C. The line that reads float *ad= &prt is simply assigning a ‘pointer’ variable. In C you can access the actual memory address of anything variable in the program. this is what ‘ad’ is. ‘&prt’ is the actual value stored in the variable ‘prt’. Without the &, I would be getting the address of ‘prt’, and not the actual value. I then print the string, and the address the string is stored in.

I understand that anyone who has never seen C probably thinks this is very difficult, but I hope to add a few more posts about C, looking more in depth into pointers, addresses, and printf(), among other things. Later!

Similar Posts

  • Fixing the Fatal ‘add_rewrite_tag()’ Error

    I’m working on a WordPress little side project where I am registering a new Custom Post Type and Taxonomy and came across this: Fatal error: Call to a member function add_rewrite_tag() on a non-object… After doing a Google Search to try to figure out what the issue is, all I came up with was “disable…

  • Financial Responsibility

    Note: This article was published while I was in my early 20s. I was much younger and dumber. Please don’t hold it against me. One of the perils of having a 20+ year old website! Now that I’m (dun dun dun) a college graduate, I feel like it’s time for be more fiscally responsible. My…

  • | |

    Include a Sidebar with a Shortcode in WordPress

    Recently I was faced with a pretty interesting problem where I wanted to have a page that was structured: Content – Widgets – Content. Instead of hacking together some sort of Content – Sidebar – Metadata on the backend, I decided to make sidebar widgets accessible via a shortcode you can use in the WordPress…

  • Getting Organized II

    Note: This article was published while I was in my early 20s. I was much younger and dumber. Please don’t hold it against me. One of the perils of having a 20+ year old website! Last Time, I talked about a number of different calendars to get organized. I also mentioned my personal favorite was…

  • |

    Join Me for the 1st NEPA Hackathon!

    I’m happy to announce that I (with @nepawp) am working with @tecbridge1, and The University of Scranton ACM group to put on the first (of hopefully many) NEPA Hackathon! It will be held on May 11th, 2014 from 10am – 3pm at the Scranton Enterprise Center, at 201 Lackawanna Ave. Scranton, PA 18503.

  • |

    Quick Tip: Add a Widget to WordPress

    Note: This article was published while I was in my early 20s. I was much younger and dumber. Please don’t hold it against me. One of the perils of having a 20+ year old website!A couple of weeks ago I was working on a WordPress site and thought it might be nice to add a…

2 Comments

  1. yea dude
    public class hello
    {
    public static void main (String args[])
    {
    System.out.print(“Hello World”);
    }
    }

    rofl

    i was looking at it and was like y is there an array lol

    is there a toString or a tokenizer function?

  2. Several weeks ago they came out with a new eLoader for the psp to play old homebrew.

    First thing they did was Hello World

    It was more of a “Fuck You Sony Security Checks”

Comments are closed.