title: Inconsistent Data in variable
body: <pre><code>#include&lt;iostream&gt;
  #include&lt;conio.h&gt;
  using namespace std;
  
  
      struct node
  {
      node *next;
      node *prev;
      node *fnext;
      node *fprev;
  
      int device_number;
      int inode_number;
      int ref_count;
      bool locked;
  
  };
  
  node* Create(int inum,int dnum)
  {
      node A;
  
      A.next=A.prev=A.fnext=A.fprev=NULL;
  
      A.inode_number=inum;
      A.device_number=dnum;
      A.ref_count=0;
      A.locked=false;
  
      return &amp;A;
  }
  
  class Sample
  {
  public:
      Sample()
      {
          node*A= Create(0,0);
  
              cout&lt;&lt;A-&gt;device_number&lt;&lt;A-&gt;inode_number;
          Pass(A);
      }
  
      void Pass(node* A)
      {
          cout&lt;&lt;A-&gt;device_number&lt;&lt;A-&gt;inode_number;
      }
  
  
  };
  int main()
  {
      Sample S;
  
  
      getch();
      return 0;
  
  }
  </code></pre>
  
  <p>This is a small part of a big program. Here the focus is that i am getting garbage values like -868456546 in function Pass for node* A attribute values whereas in Constructor after using global function Create(int,int) for initializing node *A  I am getting correct values i.e 00. So this should not be happening as I am passing the same pointer to function Pass. What is the problem here ?</p>