Returning Values from Functions | Creating Functions in Objective-C (2023)

I would like to receive exclusive offers and hear about products from Peachpit and its family of brands. I can unsubscribe at any time.


Pearson Education, Inc., 221 River Street, Hoboken, New Jersey 07030, (Pearson) presents this site to provide information about Peachpit products and services that can be purchased through this site.

This privacy notice provides an overview of our commitment to privacy and describes how we collect, protect, use and share personal information collected through this site. Please note that other Pearson websites and online products and services have their own separate privacy policies.

Collection and Use of Information

To conduct business and deliver products and services, Pearson collects and uses personal information in several ways in connection with this site, including:

Questions and Inquiries

For inquiries and questions, we collect the inquiry or question, together with name, contact details (email address, phone number and mailing address) and any other additional information voluntarily submitted to us through a Contact Us form or an email. We use this information to address the inquiry and respond to the question.

Online Store

For orders and purchases placed through our online store on this site, we collect order details, name, institution name and address (if applicable), email address, phone number, shipping and billing addresses, credit/debit card information, shipping options and any instructions. We use this information to complete transactions, fulfill orders, communicate with individuals placing orders or visiting the online store, and for related purposes.


Pearson may offer opportunities to provide feedback or participate in surveys, including surveys evaluating Pearson products, services or sites. Participation is voluntary. Pearson collects information requested in the survey questions and uses the information to evaluate, support, maintain and improve products, services or sites; develop new products and services; conduct educational research; and for other purposes specified in the survey.

Contests and Drawings

Occasionally, we may sponsor a contest or drawing. Participation is optional. Pearson collects name, contact information and other information specified on the entry form for the contest or drawing to conduct the contest or drawing. Pearson may collect additional personal information from the winners of a contest or drawing in order to award the prize and for tax reporting purposes, as required by law.


If you have elected to receive email newsletters or promotional mailings and special offers but want to unsubscribe, simply email

Service Announcements

On rare occasions it is necessary to send out a strictly service related announcement. For instance, if our service is temporarily suspended for maintenance we might send users an email. Generally, users may not opt-out of these communications, though they can deactivate their account information. However, these communications are not promotional in nature.

Customer Service

We communicate with users on a regular basis to provide requested services and in regard to issues relating to their account we reply via email or phone in accordance with the users' wishes when a user submits their information through our Contact Us form.

Other Collection and Use of Information

Application and System Logs

Pearson automatically collects log data to help ensure the delivery, availability and security of this site. Log data may include technical information about how a user or visitor connected to this site, such as browser type, type of computer/device, operating system, internet service provider and IP address. We use this information for support purposes and to monitor the health of the site, identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents and appropriately scale computing resources.

Web Analytics

Pearson may use third party web trend analytical services, including Google Analytics, to collect visitor information, such as IP addresses, browser types, referring pages, pages visited and time spent on a particular site. While these analytical services collect and report information on an anonymous basis, they may use cookies to gather web trend information. The information gathered may enable Pearson (but not the third party web trend services) to link information with application and system log data. Pearson uses this information for system administration and to identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents, appropriately scale computing resources and otherwise support and deliver this site and its services.

Cookies and Related Technologies

This site uses cookies and similar technologies to personalize content, measure traffic patterns, control security, track use and access of information on this site, and provide interest-based messages and advertising. Users can manage and block the use of cookies through their browser. Disabling or blocking certain cookies may limit the functionality of this site.

Do Not Track

This site currently does not respond to Do Not Track signals.


Pearson uses appropriate physical, administrative and technical security measures to protect personal information from unauthorized access, use and disclosure.


This site is not directed to children under the age of 13.


Pearson may send or direct marketing communications to users, provided that

  • Pearson will not use personal information collected or processed as a K-12 school service provider for the purpose of directed or targeted advertising.
  • Such marketing is consistent with applicable law and Pearson's legal obligations.
  • Pearson will not knowingly direct or send marketing communications to an individual who has expressed a preference not to receive marketing.
  • Where required by applicable law, express or implied consent to marketing exists and has not been withdrawn.

Pearson may provide personal information to a third party service provider on a restricted basis to provide marketing solely on behalf of Pearson or an affiliate or customer for whom Pearson is a service provider. Marketing preferences may be changed at any time.

Correcting/Updating Personal Information

If a user's personally identifiable information changes (such as your postal address or email address), we provide a way to correct or update that user's personal data provided to us. This can be done on the Account page. If a user no longer desires our service and desires to delete his or her account, please contact us at and we will process the deletion of a user's account.


Users can always make an informed choice as to whether they should proceed with certain services offered by Adobe Press. If you choose to remove yourself from our mailing list(s) simply visit the following page and uncheck any communication you no longer want to receive:

Sale of Personal Information

Pearson does not rent or sell personal information in exchange for any payment of money.

While Pearson does not sell personal information, as defined in Nevada law, Nevada residents may email a request for no sale of their personal information to

Supplemental Privacy Statement for California Residents

California residents should read our Supplemental privacy statement for California residents in conjunction with this Privacy Notice. The Supplemental privacy statement for California residents explains Pearson's commitment to comply with California law and applies to personal information of California residents collected in connection with this site and the Services.

Sharing and Disclosure

Pearson may disclose personal information, as follows:

  • As required by law.
  • With the consent of the individual (or their parent, if the individual is a minor)
  • In response to a subpoena, court order or legal process, to the extent permitted or required by law
  • To protect the security and safety of individuals, data, assets and systems, consistent with applicable law
  • In connection the sale, joint venture or other transfer of some or all of its company or assets, subject to the provisions of this Privacy Notice
  • To investigate or address actual or suspected fraud or other illegal activities
  • To exercise its legal rights, including enforcement of the Terms of Use for this site or another contract
  • To affiliated Pearson companies and other companies and organizations who perform work for Pearson and are obligated to protect the privacy of personal information consistent with this Privacy Notice
  • To a school, organization, company or government agency, where Pearson collects or processes the personal information in a school setting or on behalf of such organization, company or government agency.


This web site contains links to other sites. Please be aware that we are not responsible for the privacy practices of such other sites. We encourage our users to be aware when they leave our site and to read the privacy statements of each and every web site that collects Personal Information. This privacy statement applies solely to information collected by this web site.

Requests and Contact

Please contact us about this Privacy Notice or if you have any requests or questions relating to the privacy of your personal information.

Changes to this Privacy Notice

We may revise this Privacy Notice through an updated posting. We will identify the effective date of the revision in the posting. Often, updates are made to provide greater clarity or to comply with changes in regulatory requirements. If the updates involve material changes to the collection, protection, use or disclosure of Personal Information, Pearson will provide notice of the change through a conspicuous notice on this site or other appropriate way. Continued use of the site after the effective date of a posted revision evidences acceptance. Please contact us if you have questions or concerns about the Privacy Notice or any objection to any revisions.

Last Update: November 17, 2020


How to return multiple values from a function in Objective-C? ›

Return multiple values from a function in objective C
  1. func getData() -> (Int, Int, Int) { //...code here return ( hour, minute, second) }
  2. - (void)getHour:(int *)hour minute:(int *)minute second:(int *)second { *hour = 1; *minute = 2; *second = 3; }

Can I return 2 values from a function in C? ›

Can you return multiple values from a function in C? Multiple values cannot be returned from a function in C or C++.

Can a function return more than one value if no justify your answer? ›

In C or C++, we cannot return multiple values from a function directly. We can return more than one value from a function by using the method called “call by address”, or “call by reference”. In the invoker function, we will use two variables to store the results, and the function will take pointer-type data.

Is it possible to return multiple values from a function? ›

Multiple values cannot be returned from a function in JavaScript but multiple values can be stored in an array or in an object and then the array or the object can be returned.

How to return multiple values from a function in C example? ›

The Best Way to Return Multiple Values from a C++17 Function
  1. Using output parameters: auto output_1( int &i1) { i1 = 11; return 12; }
  2. Using a local structure: auto struct_2() { struct _ { int i1, i2; }; return _{21, 22}; }
  3. Using an std::pair : auto pair_2() { return std::make_pair(31, 32); }
  4. Using an std::tuple :
Jun 30, 2022

Can you return multiple values from a function in C#? Provide some examples? ›

No, you can't return multiple values from a function in C# (for versions lower than C# 7), at least not in the way you can do it in Python. However, there are a couple alternatives: You can return an array of type object with the multiple values you want in it. You can use out parameters.

How many values can be returned from a function? ›

Always, Only one value can be returned from a function.

Can a function return another function in C? ›

Yes any function can return a function pointer.

How many return values can a function give? ›

A function can only return a single object.

Do functions only return one value? ›

A value-returning function can only return a single value back to the caller each time it is called. Note that the value provided in a return statement doesn't need to be literal -- it can be the result of any valid expression, including a variable or even a call to another function that returns a value.

How many values can a function return in C? ›

A function in C can return only one value.

Why does my function not return a value? ›

Void functions are created and used just like value-returning functions except they do not return a value after the function executes. In lieu of a data type, void functions use the keyword "void." A void function performs a task, and then control returns back to the caller--but, it does not return a value.

Is a function Cannot return two values True or false? ›

Explanation: True, A function cannot return more than one value at a time. Because after returning a value the control is given back to calling function.

Can a function return multiple values True or false? ›

Explanation: True, A function cannot return more than one value at a time. because after returning a value the control is given back to calling function.

Which of the following return type Cannot be used for a function in C? ›

struct, void and char * return-type cannot be used for a function in C.

How to use a value from one function in another in C? ›

There are two ways to pass parameters in C: Pass by Value, Pass by Reference.
  1. Pass by Value. Pass by Value, means that a copy of the data is made and stored by way of the name of the parameter. ...
  2. Pass by Reference. A reference parameter "refers" to the original data in the calling function.

What is meant by nesting of function in C? ›

A nested function is a function defined inside the definition of another function. It can be defined wherever a variable declaration is permitted, which allows nested functions within nested functions. Within the containing function, the nested function can be declared prior to being defined by using the auto keyword.

Can a function return an array in C? ›

In C, a return array can be achieved using a struct, static array as well as a dynamically allocated array.

What technique in C# can be used to return multiple values from a method? ›

Using Tuple Class

A tuple is a data structure that lets you easily package multiple values in a single object. Tuples are commonly used to return multiple values from a method.

What is the maximum number of values a method function can return using a return keyword? ›

Syntax. The return_type can be any valid data type. A returning function must end with a return statement. A function can return at the most one value.

How to return more than 2 values in C#? ›

There are 2 ways of returning multiple values using output parameters. We can use formal parameters modified by the out keyword. Detail We can allocate a KeyValuePair instance to store the result values. A Tuple (or ValueTuple) can also be used.

Does each function have to return a value? ›

If a function is defined as having a return type of void , it should not return a value. In C++, a function which is defined as having a return type of void , or is a constructor or destructor, must not return a value. If a function is defined as having a return type other than void , it should return a value.

Can a function return another function? ›

A function can return a function in Python because functions are treated as first-class objects. This means that you can assign a function to a variable, pass it as an argument to another function, or use it as a return value in a function. Defining functions in other functions and returning functions are all possible.

How do you return a value from a function? ›

To return a value from a function, you must include a return statement, followed by the value to be returned, before the function's end statement. If you do not include a return statement or if you do not specify a value after the keyword return, the value returned by the function is unpredictable.

Can a function return a value in C? ›

A function returns a single value by means of the return statement. If the changes are made within the function to the variables, then they are local to that function. A calling function's variables are not affected by the actions of a called function.

Is there a limit for functions in C? ›

There is no limit on the number of functions in a C Program.

Which functions Cannot return values? ›

The void functions are called void because they do not return anything. “A void function cannot return anything” this statement is not always true. From a void function, we cannot return any values, but we can return something other than values.

Does every function may not return a value? ›

Correct answer is void. A "non-returning" function is a function which cannot return normally. A function that does not return a value is called a non-value returning function (or a void function).

What happens when a function returns a value? ›

A return is a value that a function returns to the calling script or function when it completes its task. A return value can be any one of the four variable types: handle, integer, object, or string. The type of value your function returns depends largely on the task it performs.

What happens if a function doesn't return? ›

If no return statement appears in a function definition, control automatically returns to the calling function after the last statement of the called function is executed. In this case, the return value of the called function is undefined.

What values never repeat in a function? ›

A function says that for every x, there is exactly one y. That is, y values can be duplicated but x values can not be repeated.

What values Cannot repeat in a function? ›

To put it concisely: In a function, there can only be one x-value for each y-value. There can be duplicate y-values but not duplicate x-values in a function.

Can a function return a value True or false? ›

Explanation: True, A function cannot return more than one value at a time. because after returning a value the control is given back to calling function.

Can a function return true or false in C? ›

C does not have boolean data types, and normally uses integers for boolean testing. Zero is used to represent false, and One is used to represent true. For interpretation, Zero is interpreted as false and anything non-zero is interpreted as true.

Which function returns true if all conditions are true? ›

The all() function returns True if all items in an iterable are true, otherwise it returns False.

What is true about return type of functions in C? ›

Explanation: In C, functions can return any type except array and functions. This means that a function can return a value of any data type such as int, float, char, double, struct, etc. However, it cannot return an array or another function.

Which function is not returning value in C? ›

In C programming, a function that does not take any arguments and does not return a value is called a void function.

Can a function return multiple types in C? ›

In C or C++, we cannot return multiple values from a function directly. In this section, we will see how to use some trick to return more than one value from a function. We can return more than one values from a function by using the method called “call by address”, or “call by reference”.

How to return multiple values from a function in C or C++? ›

While C++ does not have an official way to return multiple values from a function, one can make use of the std::pair , std::tuple , or a local struct to return multiple values.

How to return multiple values from procedure? ›

In order to fetch the multiple returned values from the Stored Procedure, you need to make use of a variable with data type and size same as the Output parameter and pass it as Output parameter using OUTPUT keyword. You can also make use of the Split function to split the comma separated (delimited) values into rows.

How to take multiple values in C? ›

Here an example:
  1. int main()
  2. {
  3. int a,b,c,d; // you can add as more as you need.
  4. printf("Enter a, b, c and d: ");
  5. scanf("%d,%d,%d,%d", &a,&b,&c,&d);// they're separated by comma.
  6. //scanf("%d %d %d %d", &a,&b,&c,&d); //they're separated by space.
  7. return 0;
  8. }

How many values can a function return? ›

A function can only return a single object.

Can you have multiple return statements in a function C++? ›

A function can have any number of return statements.

Can functions may have multiple return statements C++? ›

You can have multiple return statements and it should not matter, if you are returning the same variable. However if you have multiple variables in your function and you return then differently depending on the code flow the compiler cannot perform such optimisation.

How to use a value from another function in C? ›

define another function which accepts input and pass it to function2 like: //main function int f = function1();//return F from function1 function2(f); Or if you can call function2 from function1, then you could do something like: //function1 function2(F); //function1 cond..

How do you return multiple values in a decision table? ›

Return multiple results

Under the Results tab, if you enable the Evaluate all rows option, the decision table evaluates all rows defined in the decision table. If the condition is true, the decision table performs the actions and returns an array of results that can be parsed.

How do you return multiple values from a function in go? ›

  1. Step 1 − Declare the variables.
  2. Step 2 − Initialize the variables.
  3. Step 3 − Call the function that returns multiple values.
  4. Step 4 − Print the result.
Jan 11, 2023

How to pass multiple values to a parameter in stored procedure? ›

To execute procedure with parameters simply write the parameter value in EXECUTE clause followed by procedure name. To add more than one parameter we simply add subsequent parameters followed by the first. See the above example. To execute the stored procedure simply add parameter values after the first value as below.

Can you assign multiple values to a variable in C? ›

How to assign multiple values to same variable in C#? To set multiple values to same variable, use arrays in C#. Let's say instead of taking 5 variables, set these 5 variables using arrays in a single variable.

How to run multiple functions at the same time in C? ›

In C is not possible. Even it is not possible in one computer. For executing at least two functions (jobs) simultaneously there must be minimum two independent computers (performers). Multi-threading allows execute only one function at a time.

How to take multiple inputs in different lines in C? ›

"%[^;]s" specifies that scanf will take all characters as input except ';' character. As soon as user enters ';' character scanf function stops reading input and returns.

Do functions return a value? ›

In general, a function takes arguments (if any), performs some operations, and returns a value (or object). The value that a function returns to the caller is generally known as the function's return value.

How many return can I write in a function? ›

Multiple return statements can be written but the first one that is called will exit the function and return whatever you choose to return. see... when you write 'return' statement in any function whether it's a by-default or any defined function.


Top Articles
Latest Posts
Article information

Author: Duane Harber

Last Updated: 10/01/2024

Views: 6418

Rating: 4 / 5 (51 voted)

Reviews: 90% of readers found this page helpful

Author information

Name: Duane Harber

Birthday: 1999-10-17

Address: Apt. 404 9899 Magnolia Roads, Port Royceville, ID 78186

Phone: +186911129794335

Job: Human Hospitality Planner

Hobby: Listening to music, Orienteering, Knapping, Dance, Mountain biking, Fishing, Pottery

Introduction: My name is Duane Harber, I am a modern, clever, handsome, fair, agreeable, inexpensive, beautiful person who loves writing and wants to share my knowledge and understanding with you.