What is the counterpart of this C pointer programme in C#?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • priyamtheone
    New Member
    • Sep 2007
    • 88

    What is the counterpart of this C pointer programme in C#?

    I'd like to know how the following programme on pointer written in C can be written in C#, especially how to use the keywords in the C programme like &i and *p in C#. Please clarify.

    Code:
    #include <stdio.h>
    
    void f(int *p, int *q)
    {
    	p = q;
    	*p = 2;
    }
    
    int i = 0, j = 1;
    
    int main()
    {
    	f(&i, &j);
    	printf("%d %d \n", i, j);
    	return 0;
    }
  • dev7060
    Recognized Expert Contributor
    • Mar 2017
    • 655

    #2
    I'd like to know how the following programme on pointer written in C can be written in C#, especially how to use the keywords in the C programme like &i and *p in C#. Please clarify.

    Comment

    • priyamtheone
      New Member
      • Sep 2007
      • 88

      #3
      @dev7060: The MSDN link you provided along with this link provide a basic concept on how to use the address-of operator and the pointer indirection operator while working with pointer concepts in C#. Thanks for the reference.

      Comment

      Working...