User Tools

Site Tools


user:csteve16:cprog:part1

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
user:csteve16:cprog:part1 [2011/09/30 20:49] csteve16user:csteve16:cprog:part1 [2011/09/30 21:00] (current) csteve16
Line 1: Line 1:
 +== Part 1 ==
 +
 +Due to my ignorance I did not know that I required 4 separate entries I apologize this wont happen again.
 +
 + I have been taking classes in not only this class but also Joes discrete structures class. 
 +This has caused me to learn a lot about c programming in the past month. The second day of class we 
 +had to learn how to recreate string.h due to situations such as these I have learned a lot about 
 +strings in c programming and a good amount about arrays. Right now I am dealing with some confusion
 + on the implementation of linklist. I fully understand how they work but I am confused as how to 
 +actually include them and manipulate them in my programs. The challenges I face with this course 
 +are pretty trivial in retrospect this pas month has been a pretty bad month personally so I was 
 +thrown behind in all of my classes. But now that things have settled down I plan on improving myself in all my classes
 +
 +
 +
 +== Topics ==
 +
 +
 +Array
 +An array is a series of elements of the same type placed in contiguous memory locations that can be individually referenced by adding an index to a unique identifier.
 +
 +#include <stdio.h>
 +
 +int main()
 +{
 +    int samArray[52]  //this would declare a simple 52 elemnt array or the type int
 +    return(0);
 +}
 +
 +
 +=== 
 +String ===
 +
 +C does not have a string type as other modern programming languages. C only has character type so a C string is defined as an array of characters or a pointer to characters.
 +#include <stdio.h>
 + 
 +int main()
 +{
 +    Char array[50] //this will create a 50 character array that the user or the programer can insert a string into
 +    return(0);
 +}
 +
 +
 + ==== 
 + Variable ====
 + 
 + A variable is a way of referring to a memory location used in a computer program. This memory location holds values- perhaps numbers or text or more complicated types of data like a payroll record. 
 + Pointer
 + A pointer is a special kind of variable in C and C++ that holds the address of another variable. 
 + 
 + 
 + 
 + ===== I/O =====
 + 
 + I/O is an abbreviation of Input / Output and refers to the transfer of data to or from an application. 
 + There are three standard libraries for I/O in C (STDIO, STDOUT, STDERR)
 + 
 + 
 + 
 + ====== Header ======
 + 
 +The header file is used to access the standard library of functions and personalized functions that you or other programmers have created.
 +
 +
 + ====== 
 + Multi-dimensional arrays ======
 +  
 + the same as a regular array with the exception that instead of storing one type of variable multiple variables are stored
 + 
 + 
 + ====== 
 + The C Library ======
 + 
 + The C library holds full source code from example articles, reader submitted code and any code that is in the public domain
 + 
 + 
 + ====== 
 + Command-line arguments ======
 + 
 +Functions that require you to enter arguments from the command line
 + 
 + ====== 
 + logic and operators (and, or, not, xor) ======
 + 
 + Aids in the helping of comparing values and situations where more than two things need to be compared
 + 
 + 
 + ====== 
 + Scope ======
 + 
 + Scope refers to identifiers, that is types, functions, classes and variables and is that part of the source code where the particular idntifier is visible. 
 + 
 + 
 + ====== 
 + File Access ======
 +
 + The ability to read, write or execute a file based on what permissions you have
 +
 +== 
 +Objective ==
 +
 +
 +== 
 +Experiments ==
 +
 +
 +1.What would happen in a program that counted the number of characters in a string if you entered 2 separate string in the same line.
 +
 +I believe that the program will only grab the characters until the null terminator
 +
 +{{:user:csteve16:cprog:count_program.png?200|}}
 +
 +{{:user:csteve16:cprog:count_run.png?200|}}
 +
 +The null terminator stops scan f from continuing on in the array
 +
 +
 +
 +2.What would happen if you were to insert an integer value into a program that expects a string value?
 +
 +I beilive that it will still treat the numbers as a character and treat them as such
 +
 +{{:user:csteve16:cprog:count_run_num.png?200|}}
 +
 +The characters where counted as characters instead of numbers meaning that with a few adjustments you could convert this count program into a base 10 number converter
 +
 +
 +
 +