I see. Inheritance might have been the issue. I remember going over that in class, but that was after I got lost over the process of designing a software program to be used in the "real world", so...
Type: Posts; User: arrgh
I see. Inheritance might have been the issue. I remember going over that in class, but that was after I got lost over the process of designing a software program to be used in the "real world", so...
Is there a way to fix it? Or is it better to not use base pointers in derived classes?
Nope, it's just testing whether you can understand the code. Just know general output and ignore compile errors. If ExampleClass 3 is printed out, then what exactly do you have to watch out for when...
There was a side note mentioning "be careful with pointer arithmetic" and 3 seems like the obvious answer, so...
hehe, oops... must have zoned out when the prof was explaining it.
Thanks for clearing that up!
ExampleClass 3. But like I said, that doesn't seem right.
I'm studying for an exam, and I had some quick questions. What does this code output?
class ExampleClass {
private: int i;
public:
ExampleClass(int j) { i=j; }
int get_i() { return...
If you declare a variable extern inside a function, then the variable has static storage duration, but still has a block scope, so is there a way to change the scope of a variable within a function?
I have 3 files: stack.h, calc,c and stack.c
void make_empty(void);
int is_empty(void);
int pop(void);
#include "stack.h"
main() {
make_empty();
...
But which has greater precedence? For example:
i >> ~j ^ k
Would this be (i >> (~j)) ^ k or i >> ((~j) ^ k)?
Oooh. So initialization is basically creating a variable and assigning it a value all in go, and assignment is changing the value of an already existing variable. It makes more sense when you say it...
I'm studying for an exam, so hopefully someone can clarify some things for me. Thought I'd post everything under one thread, instead of making a new one for every question that comes up. I typed up a...
I'm studying for an exam and just came across a sentence: "Initialization isn't the same as assignment." What? I thought when you assigned a variable a value, you're initializing the variable. If...
I know that the first is a declaration, and the second is an assignment:
int a;
a = 1;
What does it mean by "if an identifier is defined"? Has it been declared and assigned or just declared?
...
How would you go about writing the code for calculating the determinant of a matrix? I've got the math part figured out, but I can't seem to find the pattern to use in a for loop.
[ 11 12 13 ]...
I'm reviewing for an exam by working the chapter exercises, and I'm confused on how to use and write the compare function for qsort.
"Write a program that prompts the user to enter a series of...
I figured out how to create a linked list. Now I'm having a problem with a while loop that adds 2 polynomials together. Everything seems to work correctly up until exiting where the loop checks the...
I'm trying to use a for loop to create new structures of a linked list, but I keep overwriting the last struct and I don't know how to fix it.
struct node *make_linked_list(char *pointArray[],...
Okay, I'm really confused about linked lists. I'm trying to add a node for each term of a polynomial containing the coefficient and the exponent, and I have no clue how to connect the new node to the...
YAY, everything works... Thanks, everybody!!
Now, next question: What would the function header for a function that returns an array of pointers to structures and takes in an array of pointers...
The first number is supposed to be the number of polynomials in the file. So the empty string should be polynomial "0".
Hehe, oops... Thanks!
Since the 10th polynomial doesn't exist, how would you change the empty array to 0? Could you just insert an if statement checking whether each array is "" and then replace...
ok, new code. I'm not sure if I'm using the fgets right, since I usually get by with looping scanf("%c"...), but since the program works, I think I'm going in the right direction. I haven't freed...
I think I've found the problem. I'm supposed to read in 10 polynomials from a file, but there's only 9 available, so the last should be a 0. I remember someone saying that calloc creates a block of...
So now I've got the warnings down to fscanf and fopen are unsafe and one other:
warning C4047: '=' : 'char' differs in levels of indirection from 'void *'
line 61, which is
*(a+p) = ch;
...