Hello, I have a problem, I was assigned to print a linked list but as a vector of char (I cannot use the normal string type) ,this is what I have:
1 2 3 4 5 6 7 8 9
char* List::asString(){
Node* ite = new Node();
ite= first;//ite is like an iterator of the list
for(int i=0; i<sizeOfList; ++i){//sizeOfList is the total of node of the list
arr[i]=ite->element() ;
ite= ite->next();
}
return arr;
}
But when I print that, I get a bunch of weird symbols...
I need help!!
What a beautiful way to talk.... they are not stupid, they are necessary.
Node, it's a node which contains an int data, and the next node....
ite is the iterator that goes all through the list.
I do not see where you convert int to char. But in any case you simply can assign an integer value to an object of type char if the value can be represented in char. For example