Posts

Showing posts with the label User Defined Functions

Functions in C++ - Definition, Types and Examples | सी++ में फंक्शन की परिभाषा , प्रकार एवं उदाहरण

A function in C++ is a block of code that performs a specific task. Functions help divide a large program into smaller, manageable parts. They make programs easier to understand, reuse, test, and maintain. C++ में Function code का एक block होता है, जो किसी विशेष कार्य को perform करता है। Functions की सहायता से एक बड़े program को छोटे और manageable parts में divide किया जा सकता है। इससे program को समझना, दोबारा उपयोग करना, test करना और maintain करना आसान हो जाता है। What is a Function in C++? A function is a named, reusable block of statements that performs a particular operation. A function executes when it is called from another part of the program or from another function. Function statements का एक named और reusable block होता है, जो कोई विशेष operation perform करता है। Function तब execute होता है जब उसे program के किसी अन्य भाग या दूसरे function से call किया जाता है। Example: #include <iostream> using namespace std; void display() { cout << "Welcome to C++ Progr...

return Statement in C++ - Explained with Examples

The return statement in C++ is a jump statement used to terminate the execution of a function and transfer control back to the calling function. It can also return a value from a function to the calling statement. The return statement is commonly used in user-defined functions and the main() function. C++ में return statement एक Jump Statement है, जिसका उपयोग function का execution समाप्त करके control को calling function में वापस भेजने के लिए किया जाता है। इसके माध्यम से function किसी value को calling statement में return भी कर सकता है।  return statement का उपयोग मुख्य रूप से user-defined functions और main() function में किया जाता है। 1. Syntax of return Statement (सिंटैक्स) The return statement has two common forms. return statement के दो सामान्य forms होते हैं। 1. Return without a value return; This form is used in functions having the return type void . इस form का उपयोग void return type वाले functions में किया जाता है। 2. Return with a value return expression; This form re...