I have created a pointer to a structure, the structure contains a single data member of type int. Whenever I print the data member without initializing the pointer if it is int or long it is always printing 1 if I set it to double it prints random values.
#include<iostream>
using namespace std;
struct node {
int data ;
};
int main() {
struct node a ;
struct node *c ;
cout << a.data << endl ;
cout << c -> data << endl ;
}
I am using g++ to compile on Ubuntu.