This week was my first back in school in a little while and I am enjoying it. in data structures we started talking about pointers and writing small programs to test pointers and get familiar with them. in discrete structures we started on logic and started writing programs to implement the different boolean logic i picked converse non implication. Also in both classes we have been brushing up on / reviewing C which is never a bad thing the only challenges so far i feel I'm facing is the logic gate I guess also the size program in data where we had to test the size limits of the various data types but that is a good challenge and its always fun to try and solve problems and see peoples different approaches to the same problem.
This week we started working on linked lists and doubly linked list we wrote a linked list together than on our own we implemented differernt functions like append, insert, and remove we also started a doubly linked list and are going to be implementing the different functions for that as well. in discrete we refined our logic programs and started working on sets i choose to use a linked list to write my set program all in all good week plenty of things to keep me busy I also finished my keywords for discrete and data
This week we got our other random keywords that we need to work on and show an example of we worked more on linked lists which i am getting better at thier still a little tuff to just do without writting it out and tweaking logic we are also working on the doubly linked list more which is always fun but other than that we havent started on anything new yet we talked today about whats coming next stacks and queues. and are just finishing up doubly linked list
This week I finished my opus part 1 and finished my other keywords and experiment my experiment wasn't to special but I couldn't think of any others to do. In class we started writing a sort program to sort data and finished all the modifications on our singly linked list. next week as I understand it we will begin on doubly linked list insert and remove and work on our sort program so far so good happy about completing the first part of my opus
Function Pointers
Function Pointers are pointers that point to the memory location of a function and can be used to call and pass arguments to said function. This can be used when you might have a few functions and only one of them needs to be called but at the time of writing the program you don't know which one needs to be called.
Holds the address of another variable.
List any sites, books, or sources utilized when researching information on this topic. (Remove any filler text).
Demonstration of the indicated 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:
/* * Declaring and using a class pointer */ #include <iostream> #include "class.h" using namespace std; int main() { class variable; class *classPointer = &variable; int localVariable; classPointer->classSetFunction(localVariable); return(0); }
Converse Nonimplication
Converse Non-implication is the negation of the reverse of implication. implication is if … then where it is only false if the first term “p” is true and the second term “q” is false so converse non-implication is only true if the first term “p” is false and the second term “q” is true
exclusive disjunction/nonequivalence
Exclusive disjunction means that only one can be true, but not both. It's basically an XOR.
Demonstration of the indicated 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:
/* * Exclusive Disjunction */ #include <stdio.h> int main() { int p; int q; int r; printf("Enter a 1 or a 0 to xor:\n"); scanf("%d", &p); printf("Enter a second 1 or 0:\n"); scanf("%d", &q); r=p^q; printf("The xor of the values you've entered is: %d",r); return(0); }
Can I pass a class pointer by reference?
*http://cboard.cprogramming.com/c-programming/109893-passing-pointers-reference.html *http://www.tutorialspoint.com/cplusplus/cpp_passing_pointers_to_functions.htm
*http://linuxconfig.org/c-understanding-pointers *http://stackoverflow.com/questions/1825794/passing-pointer-argument-by-reference-under-c
I feel a class pointer can be passed by reference just like a normal pointer
I am going to write a program and pass a pointer by reference.
1 #include <iostream> 2 3 4 Class A 5 { 6 public: 7 A(); 8 function(int **pointer) 9 10 private: 11 int variable; 12 int filler; 13 }; 14 15 void A::functionint(int **points) 16 { 17 int *points; 18 }
1 #include <iostream> 2 #include "class.h" 3 4 using namespace std; 5 6 int main() 7 { 8 class classVariable; 9 class *classPointer = &classVariable; 10 11 int variable1; 12 13 function(&classPointer); 14 15 return 0; 16 }
Based on the data collected:
Ive discovered that class pointers can be passed by reference the same as a local pointer.