Karl Krauss
FALL 2011 OPUS
My name is Karl Krauss, I have a degree in Math/Science and currently working on Comp Sci and HPC.
Today was a good day for many reasons. It seems like my C is coming together, though I admit I know there is still a long ways to go. The best part was with my structure pointer experiment which actually proved Joe O. wrong. A very difficult task to say the least. Today I am going to do my best to finish up my keywords and work on some objectives.
Ok so the sysprog book is a bit rough(though not as rough as the discrete book) but I finally finished enough keywords for the month. Some of them I didnt really grasp, such as bit sets and bit masks. Others were a little easier for me(assuming I am right): inodes and data blocks. Hopefully some of this stuff will become easier to understand as we go on. Most things seem to becoming easier but a few still need work.
Standard I/O(standard input/output) Just as its name implies it deals with inputing information to the terminal, and inputing input from the keyboard
#include <stdio.h> int main() { int number; printf("Please enter a number: "); //this is standard output scanf("%d", number); //this is standard input fprintf(stderr, "this goes to STDERR\n"); //this is standard error(output) return 0; }
Libraries for the C/C++ language are actually made up of two parts. The header files that declare, and the actual library or “archive” that contains the definition. The library(“archive”) will be discussed later.
The Header files is “included” in a programmers code and allows for easy access to predefined functions. System header files are part of the C/C++ standard library. Local ones are ones defined by the programmers. Most beginning programmers use header files from the C/C++ standard library before they even know exactly what they are.
#include <stdio.h> // This is how you include a standard library header file(system) and is almost always used in some way #include "myheader.h" // This is how you include a local header file defined by a user
Arithmetic is defined as dealing with the manipulation of numbers. The basic necessity of arithmetic is operators. The basic operators are (+), (-), (*), (/), and the less known(%).
Equations are simply a combination of operators and numbers
#include <stdio.h> int main() { int a = 5, b = 6; float c = 0; printf("a = 5, b = 6 \n"); c = a + b; // equation using the (+) addition operator printf("a + b = %.2f\n", c); c = a - b; // equation using the (i) subraction operator printf("a - b = %.2f\n", c); c = a * b; // equation using the (*) multiplication operator printf("a * b = %.2f\n", c); c = (float) a / (float) b; // equation using the (/) division operator printf("a / b = %.2f\n", c); c = a % b; // equation using the (/) modular division operator. printf("a %% b = %.2f\n", c); return(0); }
As defined by Practical C programming, 3rd edition, an Operator: is a symbol that represents an action to be performed.
Bit operators allow us to work on the individual bits of a data type. Thus far I have not seen them used too much but it is important to know what they are. It will also make it clear why the equivalent logical operators are symbolized the way they are.
resources
Variables are simply memory locations that are given names and can be assigned values. Variables are used to store different types of data in memory for future usage.
The two basic variable types are Numeric and character.
Here is a list of data types and their range. (this list assumes signed integers, you can add unsigned to the data type shifting the range, size stays the same)
short Numeric - Integer signed: -32768 to 32767 unsigned: 0 to 4294967295 int Numeric - Integer signed: -2147483648 to 2147483647 unsigned: 0 to 4294967295 long Numeric - Integer signed: -2147483648 to 2147483647 unsigned: 0 to 4294967295 float Numeric - Real signed: 1.2 X 10-38 to 3.4 X 1038 no unsigned double Numeric - Real signed: 2.2 X 10-308 to 1.8 X 10308 no unsigned char Character signed: -128 to 127 unsigned: 0 to 255
These values are all relative to the operating system, as is the same for the size. A char is typically one byte but that might not always be the case. Programmers should always use the sizeof() function to determine the size of the variable type they wish to use.
example:
#include <stdio.h> int main() { int a = sizeof(int),b = sizeof(short),c=sizeof(char): printf("int: %d\n", a); printf("int: %d\n", b); printf("int: %d\n", c); return 0 }
From wikipedia: a string is a finite sequence of symbols that are chosen from a set or alphabet.
For example: this entire sentence could be considered a string or several strings being printed in a certain order. In the C++ language their is an actual string variable but the C language does not have one. C handles strings by simply using an array of characters(which is really what a string is: an array of characters). In the example code I will declare an array and set it equal to a word, this can be one with pointers as well and will be discussed in the future.
example:
#include <stdio.h> int main() { char string[6] = "Hello"; /* array of characters with six elements is declared and set equal to "Hello" quotes are not stored but needed to store multiple characters. The six element is needed as the string terminator. arrays will be gone into greater depth in the future. */ printf("%s\n", string); //this is printing the string(array of characters) to the screen printf("The string is: %s\n", string); //This is printing a literal string and then the stored string(array of characters) return 0; }
Scope of a variable is the portion of a program in which a variable is known
Type casting is when you make a variable of one data type act like another type for a single operation. To cast a variable name simply use brackets() in front of the variable and include inside them the temporary variable type you wish to use. Here is some example code:
include <stdio.h> int main() { int variable = 97;// decarling a variable of int type and giving it value printf("%d\n", variable);// simply printing the value of variable as it is printf("%c\n", (char)variable);// casting variable as a character should give the ascii char value of 97 return 0; }
Here is the output:
lab46:~$ ./a.out 97 a
I would just like to add that with printf() you actually do not need to cast in this particular case but it gets the point across.
Arrays were covered in Data structs.
Version control is, simply put, a repository of files. Any change made to the source file is tracked and can be reversed if necessary. Wikipedia is an example of version control, if some one makes an improper change to a page, the original information is not lost it is stored as the previous version therefore making it easy to be restored.
Very helpful resource.
Pointers are data types whose value refers to another value stored elsewhere. When you declare a variable that is a pointer you are simply storing an address in that variable that has the data you want. The address that is pointed to is often called the pointee.
Here is an experiment I did that deals with pointers.
struct birthDate { int year, day; char month[10]; }; // the structure is now declared
struct birthDate Karls; //Now we have declared a variable called Karl witch is a structure of the birthDate type. Karls.year = 1988; //we've set Karls birthyear to 1988(lies)
resources
struct birthDate *Brad; // we have declared a variable named Brad which POINTS to a structure of the birthDate type
(*Brad).year = 1999;// this SHOULD work(in theory) Brad->year =1999;// this WILL work and is known as the structure pointer
resources
Much like structures, arrays are used to manage a large quantity of data. The difference is: an array cannot mix data types. If you have multiple data types you will need to use an array for each. Arrays are declared the same way you declare many other data types except they have an index added to end signified by the []. For example:
void main() { char array[10]; //I just declared a ten element array of the data type char array = "september";// now I have stored 9 characters within the array. }
To access individual elements of the array you simply use the index, which typically starts at 0. array[0] = s, array[1] = e, array[2] = p. This is quite handy if you need to call one particular element of an array.
A null pointer simply pointers “nowhere”. And uninitialized pointer can pointer virtually anywhere(but unknown), but a NULL pointer points nowhere meaning there is no object associated with the pointer. Setting a pointer equal to null is quite easy. Example:
{ char *variable = NULL; // all done, yes it's THAT easy for me, it can be this easy for you too! }
A Void pointer is a way to deal with raw memory. Void basically means the absence of a data type. Void pointers also allow for passing a pointer to an unspecified type.
Function pointers are an interesting concept and, at least for me, a difficult one to understand. I only recently learned of them so I am not sure how strong this entry is going to be. In simplest terms(Joe O. is going to hate this) a Function pointer is a pointer to a function; AKA: a pointer that points to the address where the function is at. They can be used when you are not sure which function you wish to call. As my understanding is limited I will simply link to a better written explanation of function pointers.
static allocation is when memory is allocated before a program is executed(compile time)
Dynamic allocation is when memory is allocated as needed during run time.
Malloc() is a function in C that allocates memory and returns the beginning address. new is a keyword for c++ and basically does the same thing malloc() does for c.
{ int *variable;//declaring a pointer to an int variable = malloc(sizeof(int)); //allocating memory for the variable } { int *variable;//declaring pointer variable = new int;// and again allocating memory for the variable }
free() and delete are the opposite of malloc() and new free() is a function in c that will de-allocate memory that was previously allocated, so that it can be used if needed. delete is a keyword in c++ that will do the same.
Linked lists lists is a sequence of nodes and each node points to the next one i the sequence. Linked lists are nice when you do not know how big the sequence(list) is going to be and allows for virtually infinite growth.
Unix systems programming, in part, is the understanding the role of an OS as well as what it means to write programs that work directly with the operating system.
sources
first page of the sysprog book that I took off of Haas' desk.
Kernel space is where the kernel, its extensions and many drivers run. The kernel is the core of the operating system.
User space is where everything outside of the kernel space is run(everything not related directly the operating system).
File access is how you access and manipulate files. To do so you need certain tools:
A File descriptor is a connection created between a process and a file when the open system call is used.
Buffering is reading data in large sizes into memory from user space and then processing it in smaller pieces as the user needs it.
A System call is a request from a program for a service of the operating system(kernel).
Everything in unix is a file. There are several file types: Directories, regular files, and links. Each file has certain properties which can be seen in unix using ls -l(this will tell you the file type as well). The properties are: permissions, owner, group, size of the file, date of last modification and name of the file.
A bitset is when a bit or group of bits are “set” to 1(true) via a bitmask. A bit mask is used for setting bits to 1 or 0, or to keep a certain section of bits.
The owner and group of a file are stored as numbers which are the User ID and Group ID. The superuser always has a value of 0, everyone else gets a non-negative integer.
The Unix Filesystem from a users viewpoint is a tree structure. It branches out with each directory and new file. An inode is a struct that stores the properties of each file. Data blocks are where the actual contents of files are kept. Blocks are the same size and one file can use as many as is needed.
A directories is simply a file that contains a list of names of files along with a table of inode numbers for those file properties.
links in Unix are very similar to shortcuts in windows. It is like having multiple phonebook entries in several places. A link is simply a special file that points to another file.
Identification and definition of the chosen keyword. Substitute “keyword” with the actual 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); }
Identification and definition of the chosen keyword. Substitute “keyword” with the actual keyword.
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$
Identification and definition of the chosen keyword. Substitute “keyword” with the actual 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); }
Identification and definition of the chosen keyword. Substitute “keyword” with the actual keyword.
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$
Identification and definition of the chosen keyword. Substitute “keyword” with the actual 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); }
Identification and definition of the chosen keyword. Substitute “keyword” with the actual keyword.
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$
Arrays
What is an array? *An array is a set of consecutive memory locations used to store the same type of data.
What are arrays used for?
How do you declare an array?
Pointers
What is a pointer?
What are pointers used for?
How do you declare a pointer?
Some common applications for linked lists:
Concurrency:
State the course objective; define what that objective entails.
State the method you will use for measuring successful academic/intellectual achievement of this objective.
Follow your method and obtain a measurement. Document the results here.
Reflect upon your results of the measurement to ascertain your achievement of the particular course objective.
State the course objective; define what that objective entails.
State the method you will use for measuring successful academic/intellectual achievement of this objective.
Follow your method and obtain a measurement. Document the results here.
Reflect upon your results of the measurement to ascertain your achievement of the particular course objective.
State the course objective; define what that objective entails.
State the method you will use for measuring successful academic/intellectual achievement of this objective.
Follow your method and obtain a measurement. Document the results here.
Reflect upon your results of the measurement to ascertain your achievement of the particular course objective.
Will C allow for unsigned floats?
When looking up information on the ranges of data types I noticed there was never an unsigned range for floats, so I thought I would look into it. I am going to copy simple code trying to define unsigned floats and then copy the outcome of my attempt to compile
#include <stdio.h> int main() { float a = 5.0; // To show the compiler will have no issue declaring a float and setting it equal to a value unsigned float b = 10.0; // to show the compiler will treat 'unsigned' and 'float' as two separate keywords that do not belong together // this will be seen in the messages after attempting to compile printf("float = %f\n unsigned float = %u\n", a, b); // this is to remove other warnings when compiling return 0; }
lairstation3:~/Desktop/experiments$ gcc -Wall canfloatsbeunsigned.c canfloatsbeunsigned.c: In function ‘main’: canfloatsbeunsigned.c:6: error: both ‘unsigned’ and ‘float’ in declaration specifiers
As you can see it simply won't work, it does not compile. My research leads to a very simple answer. There is no equivalent machine code operations for the cpu to execute(the cpu is not designed to deal with unsigned floats). The url below has discussions on the subject.
I have noticed that pointers are often times a hurdle for beginning programmers. A common question I hear is: what is the difference between * and &. Early on in the learning process many people do not know what “varName” is when “char * varName” is declared. I am going to attempt to remedy this.
#include <stdio.h> #include <stdlib.h> int main() { char *varName;// I declared a variable called varName that is a pointer aka (*) to a char varName = malloc(sizeof(char)); //Malloc returns an address and sets varName = to it(sizes it as well) *varName = 'a';// I set *varName(the value AT varName) = 'a' printf("varName = 0x%x\n",(int) varName); // "varName" is a pointer to a char, meaning whatever address pointer is at, has ANOTHER address stored there printf ("*varName(the value at pointer) = %c\n", *varName);// the address that is stored in varName has a value stored and this is how you get it printf("&varName(the address of) = 0x%x\n", (int) &varName);// "varName" is at an address and this is how you get it return 0; }
lairstation3:~/Desktop/experiments$ ./a.out varName = 0x98c5008 *varName(the value at pointer) = a &varName(the address of) = 0xbfa0b90c lairstation3:~/Desktop/experiments$
Recently I got into a debate involving structure pointers. This is to show exactly what a struct pointer is:
#include <stdio.h> #include <stdlib.h> struct bin { char *string; }; int main() { struct bin *joesWrong;// declaring a pointer to a struct of the type bin joesWrong = malloc(sizeof(struct bin)); //mallocing up the struct joesWrong->string = malloc(sizeof(char)*20); //these next two lines mean the same (*joesWrong).string = malloc(sizeof(char)*20);// and will be proven in the next block of code joesWrong->string = "karl's right\n"; // we will see that the following code works as it should printf("%s\n", joesWrong->string); (*joesWrong).string = "Joe's wrong\n"; // this means that x->y and (*x).y mean the same thing printf("%s\n", (*joesWrong).string); return 0; }
This is the output of the code, and as you will see it works as expected, thus showing exactly what a function pointer is. x.(*Y) != x→y
karl's right Joe's wrong lab46:~$ ^C lab46:~$
This is a link for Joe :)
Example code:
#include <stdio.h> int main() { int number; printf("Please enter a number between 1 and 10: "); scanf("%d", &number); //here is the selection statement if (number < 5 && number >= 1) { printf("You entered a number between 1 and 4\n"); } else if (number >=5 && number <=10) { printf("\nYou entered a number between 5 and 10\n"); } else { printf("\nYou entered an invalid number.\n"); } return 0; }
Example code:
#include <stdio.h> int main() { int number = 10; int x; printf("\n"); for(x = 1; x <= number; x++) { printf("%d\n", x); } return 0; }
File access was covered in Sys prog.
Doubled linked lists are not much different than linked lists except now each node not only points to the next node but to the previous as well.
A stack is a last in first out data structure, meaning the “top” of the stack is all you have immediate access to. You can store data on top of the stack, remove it, or view it.
Pushing is when you add to the top of a stack or initializes the stack if it is empty
Popping simply removes the data stored at the top of the stack.
Top typically simply returns the value at the top of the stack but does not delete it like pop does.
Overflow is when a stack is full and cannot accept anymore data
Underflow is when the stack is empty and there is no data to be removed
LIFO means last in first out. Whatever the last thing that was stored will be the first one out. As stated before stacks are LIFO
FIFO means first in first out. Whatever the first thing that was stored will be the first one out. Queues(which will be discusses later) are FIFO
A queue is a first in first out data structure. Where with a stack you could only add or remove from the top, with a queue you add to the top(or back, depending on if you like to envision a queue as a sideways stack) but you remove from the bottom(front).
Enqueuing is a queues version of pushing. You simply add new data to the “end” of whatever type of queue you are using.
Dequeuing is the process of removing the FIRST thing that was stored in your queue, unlike a stack where the last thing stored is removed.
Overrun(queue overflow) occurs when you try to add data onto a queue that is full Underrun(queue underflow occurs when you trying to remove data from a queue that is empty
Identification and definition 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); }
Identification and definition of the chosen keyword.
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$
Identification and definition of the chosen keyword. Substitute “keyword” with the actual 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); }
Identification and definition of the chosen keyword. Substitute “keyword” with the actual keyword.
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$
Identification and definition of the chosen keyword. Substitute “keyword” with the actual 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); }
Identification and definition of the chosen keyword. Substitute “keyword” with the actual keyword.
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$
Identification and definition of the chosen keyword. Substitute “keyword” with the actual 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); }
Identification and definition of the chosen keyword. Substitute “keyword” with the actual keyword.
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$
Identification and definition of the chosen keyword. Substitute “keyword” with the actual 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); }
Identification and definition of the chosen keyword. Substitute “keyword” with the actual keyword.
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$
Identification and definition of the chosen keyword. Substitute “keyword” with the actual 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); }
Identification and definition of the chosen keyword. Substitute “keyword” with the actual keyword.
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$
Everything in unix is a file and that includes any device on the system. Depending on the device, device files can be written to and read from just like any other file. The monitor device file can be written to but not read from. A keyboard can be read from but not written to.
A race condition is when multiple processes are able to access shared data and they try to change it at the same time. It is called a race condition because the result is depending on the timing of events. page 149 of understanding unix/linux programming has a good example.
An atomic operation is when the kernel joins two or more system calls into one indivisible unit. Meaning the entire sequence of calls has to be performed or none at all. Page 150 of understanding unix/linux programming talks briefly about it.
The STREAMS model of data flow and connection attributes allows for modularity of processing. You can write or remove modules as you see fit.
Blocking is when a call waits for input. If there is no input then the program waits for it. Non-Blocking is when when blocking is turned off thus if there is no input the program will still continue.
A Signal can be defined as a one word message sent by the kernel. Each signal has a numerical code. Requests for signalcs can come from processes, exceptions and user keystrokes. Many signals cause processes to die, but there are other types of signals. You can typically find the list of signals in /usr/include/signal.h
What is the difference between a structure and a class?
How are data structures allocated and used in memory?
Just like any variable type data structures are given a memory address. Data structures typically have nodes and each node has its own address, this is done in C with the malloc() function.
State the course objective; define what that objective entails.
State the method you will use for measuring successful academic/intellectual achievement of this objective.
Follow your method and obtain a measurement. Document the results here.
Reflect upon your results of the measurement to ascertain your achievement of the particular course objective.
Design a program that handles signals.
#include <signal.h> #include <stdio.h> void intu(); void seg(); int main() { char *array; signal(SIGINT, intu); //interrupt aka ctrl c signal(SIGSEGV, seg);// good ol seg fault why is it V instead of F? getchar(); printf("%c\n", *array);// why does this continue to segment? return 0; } void intu() { printf("You tried to interrupt me but I won't let you!\n"); } void seg() { printf("I segmented!\n"); }
When defining a struct, can you give a value to any variables within the struct? If not, then why not?
Below is the code I attempted to compile:
#include <stdio.h> struct list { int variable = 57; }; int main() { /*struct list fashizzle; fashizzle.variable = 10; printf("\nThe variable is %d\n", fashizzle.variable);*/ return 0; }
Here is what happens when attempting to compile:
lab46:~/Desktop/experiments$ gcc -Wall structvar.c structvar.c:7: error: expected ':', ',', ';', '}' or '__attribute__' before '=' token lab46:~/Desktop/experiments$
So the answer to the question is: No you cannot give value to a variable when defining a struct.
The reason for this is quite simple, as I have stated in previous parts of my opus a variable is simply a human name given to an address. When you are defining a structure, you are not assigning an address yet, that does not happen until you actually declare a structure in the main program. At that point a memory address is given and now you can give it a name and store a value.
After learning about enum I was curious as to what value it starts at, is it 0 or 1? Or possibly some other random value?
Here is my code:
#include <stdio.h> int main() { enum days{sunday, monday, tuesday, wednesday, thursday, friday, saturday}; printf("%d\n", sunday); printf("%d\n", monday); return 0; }
Here is the output:
lab46:~/Desktop/experiments$ ./a.out 0 1 lab46:~/Desktop/experiments$
It would appear that the default for enum is to start at 0
I was curious if enumerated values would still allow you to math operators. Basically I am going to take an enumerated variable and see if I can add one and get the next enumerated variable.
Using the same code in previous experiment except instead of printing Monday, I will try to print sunday + 1
#include <stdio.h> int main() { enum days{sunday, monday, tuesday, wednesday, thursday, friday, saturday}; printf("%d\n", sunday); printf("%d\n", sunday+1); return 0; }
Here is the output:
lab46:~/Desktop/experiments$ ./a.out 0 1 lab46:~/Desktop/experiments$
As we can see it worked the same way as the previous experiment meaning enumerated variables can still have math ops used on them.
Despite the fact that the class is watching troll 2 on the video wall I am going to attempt to actually do some work. One more keyword for sys prog then I must tackle data structs.
The third part of opus is done and now it is time for eoce. As usual I think I overreacted to the amount of work as the teacher seems to be very understanding and doesnt seem to expect everyone to get everything done. I think he is just looking more for progress and a willingness to learn. I can safely say that I have definitely made progress and learned a lot this semester. Sometimes I got frustrated but just about every time I asked about a topic the teacher was able to lead me to learning something new. I can also safely say I cannot wait for a break!
here is a good resource for further understanding
There are three levels of access control within a class:
Identification and definition of the chosen keyword. Substitute “keyword” with the actual keyword.
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$
In computer science, Big-O and Big theta is used to describe how an algorithm responds to different input sizes. This can be used to describe an algorithm's efficiency by determining processing time and working space requirements. Depending on the bounds you wish to describe will determine which notation would be used as big-o is more for just having an upper bound where big theta is upper and lower.
Identification and definition 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); }
Identification and definition of the chosen keyword.
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$
Identification and definition of the chosen keyword. Substitute “keyword” with the actual 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); }
Identification and definition of the chosen keyword. Substitute “keyword” with the actual keyword.
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$
Identification and definition of the chosen keyword. Substitute “keyword” with the actual 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); }
Identification and definition of the chosen keyword. Substitute “keyword” with the actual keyword.
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$
Identification and definition of the chosen keyword. Substitute “keyword” with the actual 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); }
Identification and definition of the chosen keyword. Substitute “keyword” with the actual keyword.
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$
Identification and definition of the chosen keyword. Substitute “keyword” with the actual 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); }
Identification and definition of the chosen keyword. Substitute “keyword” with the actual keyword.
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$
Identification and definition of the chosen keyword. Substitute “keyword” with the actual 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); }
Identification and definition of the chosen keyword. Substitute “keyword” with the actual keyword.
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$
.
State the course objective; define what that objective entails.
State the method you will use for measuring successful academic/intellectual achievement of this objective.
Follow your method and obtain a measurement. Document the results here.
Reflect upon your results of the measurement to ascertain your achievement of the particular course objective.
State the course objective; define what that objective entails.
State the method you will use for measuring successful academic/intellectual achievement of this objective.
Follow your method and obtain a measurement. Document the results here.
Reflect upon your results of the measurement to ascertain your achievement of the particular course objective.
State the course objective; define what that objective entails.
State the method you will use for measuring successful academic/intellectual achievement of this objective.
Follow your method and obtain a measurement. Document the results here.
Reflect upon your results of the measurement to ascertain your achievement of the particular course objective.
State the course objective; define what that objective entails.
State the method you will use for measuring successful academic/intellectual achievement of this objective.
Follow your method and obtain a measurement. Document the results here.
Reflect upon your results of the measurement to ascertain your achievement of the particular course objective.
Can a child touch its parents private parts?
#include <iostream> using namespace std; class parent { private: int number; }; class child : private parent { public: char character; void print(); }; int main() { child notouchy; notouchy.number = 10; notouchy.print(); return 0; } void child::print() { cout<<number; }
lairstation3:~/Desktop$ g++ privateparts.cc -Wall privateparts.cc: In function ‘int main()’: privateparts.cc:8: error: ‘int parent::number’ is private privateparts.cc:23: error: within this context privateparts.cc: In member function ‘void child::print()’: privateparts.cc:8: error: ‘int parent::number’ is private privateparts.cc:32: error: within this context
#include <iostream> using namespace std; class parent { public: int number; }; class child : public parent { public: char character; void print(); }; int main() { child notouchy; notouchy.number = 10; notouchy.print(); return 0; } void child::print() { cout<<number; }
lairstation3:~/Desktop$ g++ privateparts.cc -Wall lairstation3:~/Desktop$ ./a.out 10
When declaring variables within a class do they default to private or public?
#include <iostream> using namespace std; class parent { int number; }; class child : parent { char character; void print(); }; int main() { child notouchy; notouchy.number = 10; notouchy.print(); return 0; } void child::print() { cout<<number; }
lairstation3:~/Desktop$ g++ privateparts.cc -Wall privateparts.cc: In function ‘int main()’: privateparts.cc:8: error: ‘int parent::number’ is private privateparts.cc:23: error: within this context privateparts.cc:17: error: ‘void child::print()’ is private privateparts.cc:24: error: within this context privateparts.cc: In member function ‘void child::print()’: privateparts.cc:8: error: ‘int parent::number’ is private privateparts.cc:32: error: within this context lairstation3:~/Desktop$
#include <iostream> using namespace std; class parent { Public: int number; }; class child : parent { Public: char character; void print(); }; int main() { child notouchy; notouchy.number = 10; notouchy.print(); return 0; } void child::print() { cout<<number; }
lairstation3:~/Desktop$ g++ privateparts.cc -Wall privateparts.cc: In function ‘int main()’: privateparts.cc:8: error: ‘int parent::number’ is inaccessible privateparts.cc:23: error: within this context lairstation3:~/Desktop$
#include <iostream> using namespace std; class parent { public: int number; }; class child : private parent { public: char character; void print(); }; int main() { child notouchy; notouchy.number = 10; notouchy.print(); return 0; } void child::print() { cout<<number; }
privateparts.cc: In function ‘int main()’: privateparts.cc:8: error: ‘int parent::number’ is inaccessible privateparts.cc:23: error: within this context lairstation3:~/Desktop$