What is the counterpart of this C pointer programme in VB.Net?

Status
Not open for further replies.

priyamtheone

Well-known member
Joined
Sep 20, 2007
Messages
96
Programming Experience
Beginner
I'd like to know how the following programme on pointer written in C can be written in VB.Net, especially how to use the keywords in the C programme like &i and *p in VB.Net. Please clarify.

C:
#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;
}
 

jmcilhinney

VB.NET Forum Moderator
Staff member
Joined
Aug 17, 2004
Messages
14,579
Location
Sydney, Australia
Programming Experience
10+
This site is not a code conversion service. As I replied to you elsewhere, it's for you to understand what functionality that C code provides and then make you best attempt to implement the same functionality in VB. You should be thinking in terms of functionality, not code. We can help if you encounter an issue when writing the VB implementation but if you're not even going to try then we're not likely to either.

You also need to decide what language you are using first. You keep asking for both C# and VB code and you're obviously not going to use both, so if people take the time to answer you in both languages then you're wasting someone's time. Not what you should be doing to strangers volunteering their time to help you.
 
Last edited:

priyamtheone

Well-known member
Joined
Sep 20, 2007
Messages
96
Programming Experience
Beginner
This site is not a code conversion service. As I replied to you elsewhere, it's for you to understand what functionality that C code provides and then make you best attempt to implement the same functionality in VB. You should be thinking in terms of functionality, not code. We can help if you encounter an issue when writing the VB implementation but if you're not even going to try then we're not likely to either.

You also need to decide what language you are using first. You keep asking for both C# and VB code and you're obviously not going to use both, so if people take the time to answer you in both languages then you're wasting someone's time. Not what you should be doing to strangers volunteering their time to help you.
Getting same reply from different websites. Don't know if different portals directing to the same website. Nonetheless, I already clarified you, I'm not seeking code conversion. Rather, I'd like to know how the concepts of address-of operator and de-reference operator are implemented in C# as I'm having a bit of a difficulty understanding them. And of course I'll try to implement the code in C#. Or else, why do you think I'm scouring through references and seeking information on the topic? But before that, I need to get the fundamentals clear on how to go about it in C#, as I've never worked on address-of and de-reference operators in the language, something that OptionBase1 helped me with in the other site. That was the kind of help I was looking for.

Also explained that a C# reference will suffice. No need for the VB code. That was a redundant post.
 
Status
Not open for further replies.
Top Bottom