[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

How can I pass parameter values from function to function?

Posted on 2006-11-27
2
Medium Priority
?
268 Views
Last Modified: 2010-04-16
Hi,

As what I state in the title, I want to know how can I pass parameter values...
Here is what I have in my codes...

public struct TypeA
{
 string name;
 int value;
}
public void Function123(int paramA, TypeA paramB)
{
 // here I try to get paramA and paramB values
}

public void Main
{
  TypeA target;
  int index;

  Function123(index, target);   <-- here I try to get values from this function but the values seem not passed through the function
}

How exactly I should do to pass parameter values??
0
Comment
Question by:xenia27
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 30

Accepted Solution

by:
anarki_jimbel earned 2000 total points
ID: 18025383
Not exactly clear what you are trying to achieve.

First, your variables are not initialized.
To pass your values to the function you need to create new struct instance and initialize integer.

If you are going to change your variables inside the function and want to see the changes afteryour  function invocation
you may use passing parameters by reference. However you need to declare your function appropriately;

        public void Function123(ref int paramA, ref TypeA paramB)
        {
            // here I try to get paramA and paramB values
        }

and in Main you invoke:

Function123(ref index, ref target);
0
 

Author Comment

by:xenia27
ID: 18026046
this is exactly what I try to figure out..thanks~
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Extention Methods in C# 3.0 by Ivo Stoykov C# 3.0 offers extension methods. They allow extending existing classes without changing the class's source code or relying on inheritance. These are static methods invoked as instance method. This…
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses

649 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question