User Tools

Site Tools


opus:spring2012:vcordes1:cprogpart1

cprog Keywords

Pointers

Since this seems to be a biggie I guess I will start here.

Definition

A pointer is a tool that “points” you to a block of memory and allows access to the data contained within.

Demonstration

Demonstration of the chosen keyword.

If you wish to aid your definition with a code sample, you can do so by using a wiki code block, an example follows:

#include<stdio.h>
#include<stdlib.h>
int main( )
 
{
        int *p1, *p2, p3, **p4;
        p1=(int *)malloc(sizeof(int)*1);
        *p1=26;
        printf("*p1 is %u\n", *p1);
        p2=p1;
        p4=&p1;
        printf("**p4 is %u\n", **p4);
        printf("*p2 is %u\n", *p2);
        *p2=61;
        return(0);
}

File Access (Read, Write, Append)

Matt withheld some info saying something about the force not being strong enough to do everything I want to be capable of with this topic but I will get there.

Definition

File Access is the ability of C to “access a file.” (crazy how these things kind of define themselves) Essentially you can pull a file into C to Read it, create a file and write it, or append the file (make changes). On a side note if you intend to open a file via C you must also close the file.

Demonstration

#include<stdio.h>
#include<stdlib.h>
 
int main()
{
        FILE *in, *out;
        char value=0;
        in=fopen("file.txt", "r");
        out=fopen("out.txt", "w");
        if (in == NULL)
        {
                printf("ERROR!\n");
                exit(1);
        }
        fscanf(in, "%hhd", &value);
        while(value !=-1)
        {
                value *=2;
                fprintf(out, "%hhd\n", value);
                fscanf(in, "%hhd", &value);
        }
        fclose(in);
        fclose(out);
        return(0);
}

Arithmetic (equations, operators)

Definition

C can do math. Math can be done in C. operators being +-/* as they would be with math and equations working the same as would be expected.

Demonstration

#include <stdio.h>
#include <stdlib.h>
 
int main()
{
    int a=1;
    int b=5;
    int c=(a+b);
    printf("%d", c);
    return(0);
}

cprog Keyword 4

Identification of chosen keyword (unless you update the section heading above).

Definition

Definition (in your own words) of the chosen keyword.

Demonstration

Demonstration of the chosen keyword.

If you wish to aid your definition with a code sample, you can do so by using a wiki code block, an example follows:

/*
 * Sample code block
 */
#include <stdio.h>
 
int main()
{
    return(0);
}

Alternatively (or additionally), if you want to demonstrate something on the command-line, you can do so as follows:

lab46:~$ cd src
lab46:~/src$ gcc -o hello hello.c
lab46:~/src$ ./hello
Hello, World!
lab46:~/src$ 

cprog Keyword 5

Identification of chosen keyword (unless you update the section heading above).

Definition

Definition (in your own words) of the chosen keyword.

Demonstration

Demonstration of the chosen keyword.

If you wish to aid your definition with a code sample, you can do so by using a wiki code block, an example follows:

/*
 * Sample code block
 */
#include <stdio.h>
 
int main()
{
    return(0);
}

Alternatively (or additionally), if you want to demonstrate something on the command-line, you can do so as follows:

lab46:~$ cd src
lab46:~/src$ gcc -o hello hello.c
lab46:~/src$ ./hello
Hello, World!
lab46:~/src$ 

cprog Keyword 6

Identification of chosen keyword (unless you update the section heading above).

Definition

Definition (in your own words) of the chosen keyword.

Demonstration

Demonstration of the chosen keyword.

If you wish to aid your definition with a code sample, you can do so by using a wiki code block, an example follows:

/*
 * Sample code block
 */
#include <stdio.h>
 
int main()
{
    return(0);
}

Alternatively (or additionally), if you want to demonstrate something on the command-line, you can do so as follows:

lab46:~$ cd src
lab46:~/src$ gcc -o hello hello.c
lab46:~/src$ ./hello
Hello, World!
lab46:~/src$ 

cprog Keyword 7

Identification of chosen keyword (unless you update the section heading above).

Definition

Definition (in your own words) of the chosen keyword.

Demonstration

Demonstration of the chosen keyword.

If you wish to aid your definition with a code sample, you can do so by using a wiki code block, an example follows:

/*
 * Sample code block
 */
#include <stdio.h>
 
int main()
{
    return(0);
}

Alternatively (or additionally), if you want to demonstrate something on the command-line, you can do so as follows:

lab46:~$ cd src
lab46:~/src$ gcc -o hello hello.c
lab46:~/src$ ./hello
Hello, World!
lab46:~/src$ 

cprog Keyword 8

Identification of chosen keyword (unless you update the section heading above).

Definition

Definition (in your own words) of the chosen keyword.

Demonstration

Demonstration of the chosen keyword.

If you wish to aid your definition with a code sample, you can do so by using a wiki code block, an example follows:

/*
 * Sample code block
 */
#include <stdio.h>
 
int main()
{
    return(0);
}

Alternatively (or additionally), if you want to demonstrate something on the command-line, you can do so as follows:

lab46:~$ cd src
lab46:~/src$ gcc -o hello hello.c
lab46:~/src$ ./hello
Hello, World!
lab46:~/src$ 

cprog Objective

cprog Objective

State the course objective

Definition

In your own words, define what that objective entails.

Method

State the method you will use for measuring successful academic/intellectual achievement of this objective.

Measurement

Follow your method and obtain a measurement. Document the results here.

Analysis

Reflect upon your results of the measurement to ascertain your achievement of the particular course objective.

  • How did you do?
  • Is there room for improvement?
  • Could the measurement process be enhanced to be more effective?
  • Do you think this enhancement would be efficient to employ?
  • Could the course objective be altered to be more applicable? How would you alter it?
opus/spring2012/vcordes1/cprogpart1.txt · Last modified: 2012/02/17 01:27 by vcordes1