======Part 1====== =====Entries===== ====Entry 1: January 31, 2012==== Today we played more with pointers. We wrote another program which delved into the realm of double pointers. I think I understand pointers but I may be over-simpplifing them. Esssentialy, they direct the computer to another location. When called to give the information contained in them they return the value of what they are pointing to. ====Entry 2: Febrauary 2, 2012==== Todday we wrote a game in class. We used some elements of things that we used in previous classes as well as looked into loops. We also looked at the rand function which is supposed to resemble a random number generator but doesn't do it very well. We did go through and fix the problem which did make it more random. We also added a loop into the code which looped the game until the user decides to quit. I understand this program and what it is doing, which is a good sign. I haven't gotten lost in the class yet which is always a hopeful start. ====Entry 3: February 7, 2012==== Today we looked at arrays. My previous experince with arrays is limited to the theoretical realm. I understood that arrays needed to be sized before you start to fill them but I never was quite sure how to actually create them in a program. Today's class helped. I am still not 100% comfortable with creating them on my own but I do see how it can be done. ====Entry 4: February 25, 2012==== Today Project 1 was due and it was rather more challenging than previously thought. I understand the logic of how to do the program and I understand what needs to be done on the project, however, I am struggling with the actual implementation of the code. When I sit to write the code I essentially draw a blank and have no idea where to begin. I believe that if I sit down more with a pseudocode and play more with syntax and read source material on how to code in C I can overcome this dilemma. Otherwise, this will be a very difficut semester. =====Keywords===== {{page>cprogpart1&nofooter}} =====Experiments===== ====Experiment 1==== ===Question=== Can a program check the upper and lower bounds ===Resources=== Class notes and book ===Hypothesis=== Yes. The program can check the upper ===Experiment=== Write a code ===Data=== #include #include int main(int argc, char **argv) { signed int input; char column=0; char row=0; printf("Enter a value (0-4): "); scanf("%d", &input); while((input<4) && (input>0)) { printf("argv[%hhu]: %c\n", input, *(*(argv+row)+column)); printf("You ran this program with %hhu arguments, they are:\n",argc); exit(1); } printf("You have input an invalid value\n"); return(0); } ===Analysis=== I know that the code should work but I am unable to get the right syntax to compile it. ===Conclusions=== I need to spend more time learning syntax. ====Experiment 2==== ===Question=== What happens if you put a semicolon on the end of a loop statement ===Resources=== the book was consulted ===Hypothesis=== The program won't compile ===Experiment=== I will add a semicolon on the end of a loop statement in a program and see what happens ===Data=== The program didn't compile. The loop statement was treated like another regular statement in the program which threw the whole program off. ===Analysis=== The hypothesis was correct although I could have gone much further into figuring out why it would not compile. The hypothesis short cited and lacks depth. ===Conclusions=== Although the program behaved as expected it could have been explore further. ====Experiment 3==== ===Question=== What types of things create a segmentation fault ===Resources=== class programs and book ===Hypothesis=== Faulty syntax will cause a seg fault ===Experiment=== Play with codes already written ===Data=== I found that mainly a logic error in the loops will give a seg fault ===Analysis=== Based on the data collected: The hypothesis was not entirely correct. The hypothesis was very vague as was the question posed. If The hypothesis could have been slightly more specific the experiment might have had a little more guidance. ===Conclusions=== The main cause of segmentation faults are logic errors but logic errors also lead to other types of problems within the program.