Solved

C++

Posted on 1998-05-06
7
125 Views
Last Modified: 2010-04-10
How do you return a char value into a method function
0
Comment
Question by:c9725458
  • 4
  • 3
7 Comments
 
LVL 22

Accepted Solution

by:
nietod earned 50 total points
ID: 1173551
I'm not sure what you mean?

How do you return a char value FROM a function?  That woud be

char ClassName::FunctionName()
{
   char ReturnValue = 'a';

   return ReturnValue;
};
0
 
LVL 22

Expert Comment

by:nietod
ID: 1173552
How do you PASS a char value into a function?  That woud be

void ClassName::FunctionName(char CharParameter)
{
   cout << CharParameter;
};

If you mean something else, can you try to reword the question?
0
 
LVL 10

Expert Comment

by:RONSLOW
ID: 1173553
I was going to answer, but nietod got in first.

You question is not well worded .. please explain a little better what it is you are wanting to do.  the phrase 'return a value into a function' doesn't make sense .. you return values FROM a function -or- you pass them INTO a function
0
Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

 
LVL 22

Expert Comment

by:nietod
ID: 1173554
Roger, this time you can't complain that I just beat you to it.  I answered yesterday.  
No word on wethor or not I answered the right questions though.
0
 
LVL 10

Expert Comment

by:RONSLOW
ID: 1173555
I know you were well ahead of me on this .. but I hadn't read noticed your comment about the other possible interpretation (only the proposed answer) .. and was just about to submit the sme thing as a comment when I noticed you'd actually addressed both ways that we could have interpretted this.  Of course, neither is probably what the poster wanted :-)

0
 
LVL 10

Expert Comment

by:RONSLOW
ID: 1173556
Looks like this IS what he wanted to know.
0
 
LVL 22

Expert Comment

by:nietod
ID: 1173557
Lucky guess?
0

Featured Post

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

When writing generic code, using template meta-programming techniques, it is sometimes useful to know if a type is convertible to another type. A good example of when this might be is if you are writing diagnostic instrumentation for code to generat…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.

776 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