- Upvotes Received
- 1
- Posts with Upvotes
- 1
- Upvoting Members
- 1
- Downvotes Received
- 0
- Posts with Downvotes
- 0
- Downvoting Members
- 0
Hello I'm trying to copy a character pointer into another character pointer. I currently have [CODE]static char *my_kstrdup(const char *buf) { char *ptr, *ret; ret = ptr = kmalloc(strlen(buf)); if(ptr = NULL) panic("kmalloc returned NULL"); for(; *buf != '\0'; ++ptr, ++buf) *ptr = *buf; *ptr = '\0'; return ret; }[/CODE] … |
|
I'm trying to make a symbol table, for a project. The project as a whole is a translator/compiler that translates an imaginary language into java. I have everything down except for the symbol table. I am currently using a Stack of Lists. The Lists are vectors of Strings so I … |
|
I'm looking at this code and I'm not sure what it prints (I don't have a C++ compiler to run it). However, I also would like to understand why it prints what it does? hope someone can help, here's the code: [CODE] class A { public: virtual void p() { … |
|
Given this piece of code [CODE] void swap(int x, int y) { x= x + y; y= x - y; x= x - y; } main () { i = 1; a[0]=2; a[1]=1; a[2]=0; swap(i,a[i]); printf("%d %d %d %d\n", i, a[0], a[1], a[2]); swap(a[i], a[i]) printf("%d %d %d %d\n", i, … |
|
I'm trying to read in a text file character by character. However, when I try to read it in it using the readChar method in DataInputStream it gives me a IOException. Heres what I have so far [CODE] FileInputStream stream; try { // Open an input stream stream = new … |
|
So explicit parametric polymorphism need not be restricted to a single type parameter. In other words I can write this in C++ [CODE]template <typename First, typename Second> struct Pair { First f; Second s; };[/CODE] Can someone help me write a funciton "makePair" that takes two paramters of different types … |
|
If I have these function variables: int (*f)(int); int (*g)(int); int (*h)(char); why can I do the assingment f=g but if I do h=g the C compiler gives me warning while the C++ compiler gives me an error. Can any one please explain this to me. |
|
I'm doing a project for a class and it says to write a program that translates code from one programming language to another. It says that my class containing my static main method should be named "Translate". It should take as input source code of a programming language as a … |
|
What does == test when applied to arrays in C++? Does it test for type equivalence or equal memory locations? |
|
Given the following function variables declarations in C++: int (*f)(int); int (*g)(int); int (*h)(char); when try to assign f=g its fine but trying to do h=g gives an error with a C++ compiler, can anyone tell me why this is? |