Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8967291
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T17:12:36+00:00 2026-06-15T17:12:36+00:00

How do I send value from one function to another? I have this example:

  • 0

How do I send value from one function to another?

I have this example:

/* Include files */
#include <iostream>
#include <string>
#include <limits>
#include <sqlca.h>
#include <sqlcpr.h>
#include <iomanip>
#include <conio.h> // ntuk password masking


/* Declaration of functions and constants used */
#include "Functions.h"

using namespace std;

void fnMainMenu();

void fnLogin()
{
char data[6] = "hello";
fnMainMenu(); // call Main Menu and I want to pass "hello"

}

void fnMainMenu()
{   
cout << "I want to display hello here?";
}

int main()
{   

    fnLogin();
    return 0;
}

How do I do this? The tutorial I found from the net explained showing data on main. Thanks in advance.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T17:12:37+00:00Added an answer on June 15, 2026 at 5:12 pm

    You can pass objects to functions as arguments. Here, fnMainMenu takes a reference to a constant std::string object as parameter and prints it out to stdout:

    void fnMainMenu(const std::string& msg)
    {
      std::cout << msg << "\n";
    }
    

    Then fnLogin() can call the function and pass it any string it likes:

    void fnLogin()
    {
      std::string s = "hello";
      fnMainMenu(s); // call Main Menu and I want to pass "hello"
    
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm working on transferring data from one database to another. For this I have
Ok now i have another problem i want to send one or more variable
I need to send form values from one page to another and from that
I want to pass a value from one Activity to another to update an
Migrating from textboxe to dropdownlist – Need to send value from a hard-coded dropdownlist
I have form and I want to send values from it with ajax to
I want to send data to a function after the default value of an
I have a PHP function that returns something: function myfunction() { $array = array('one',
I don't understand one thing. If I want to get JSON data (key-value-pairs) from
I have one js file having code as: function postResponse(url1,param1) { var url =

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.