Solved

C++

Posted on 1998-05-06
7
123 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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

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…
Errors will happen. It is a fact of life for the programmer. How and when errors are detected have a great impact on quality and cost of a product. It is better to detect errors at compile time, when possible and practical. Errors that make their wa…
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.

746 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now