title: How to return pointer in C?
body: <pre><code>#include&lt;stdio.h&gt;
  
  typedef struct node
  {
      int val;
      struct node *link;
  }hop;
  
  main()
  {
      int c;
      hop *m,*t;
      m=(hop *)malloc(sizeof (hop));
      m-&gt;val=10;
      t=change_val(m);
      printf("%d",t-&gt;val);
  }
  
  hop *change_val(node* m)
  {
      m-&gt;val=20;
      return m;
  }
  </code></pre>
  
  <p>But I got error in the function and assignment. I have tried changing the signs before the m. I tried using double pointer too. Help me.</p>