issue with linked list

#include "stdafx.h"
#include <iostream>

using namespace std;

struct node {
char myval;
node* next;
} ;

int main()
node* h;
node* n;
node* t;

h = new node();
h->myval = 'a';

cout << h->myval << h->next << endl;

n = new node();
n->myval = 'b';

cout << n->myval << n->next << endl;

return 0;

Here cout shows a0000000000 & b0000000000
can any body help

I am new to c++ , I have no idea how to print the value, I was expecting some kind of address when I use cout<< n->next
Last edited on
What is the value of next? Write some code to print it's value by itself.
Last edited on
Topic archived. No new replies allowed.