JOIN us on
WhatsApp Group Join Now
Telegram Join Join Now

हिंदी माध्यम नोट्स

Class 6

Hindi social science science maths English

Class 7

Hindi social science science maths English

Class 8

Hindi social science science maths English

Class 9

Hindi social science science Maths English

Class 10

Hindi Social science science Maths English

Class 11

Hindi sociology physics physical education maths english economics geography History

chemistry business studies biology accountancy political science

Class 12

Hindi physics physical education maths english economics

chemistry business studies biology accountancy Political science History sociology

Home science Geography

English medium Notes

Class 6

Hindi social science science maths English

Class 7

Hindi social science science maths English

Class 8

Hindi social science science maths English

Class 9

Hindi social science science Maths English

Class 10

Hindi Social science science Maths English

Class 11

Hindi physics physical education maths entrepreneurship english economics

chemistry business studies biology accountancy

Class 12

Hindi physics physical education maths entrepreneurship english economics

chemistry business studies biology accountancy

Categories: c++ language in hindi

C++ : User Define function Types in hindi , how many type of user define functions in c++ language

how many type of user define functions in c++ language , C++ : User Define function Types in hindi :-
इससे पहले के article मे function का basic structure , return type statement और argument pass को discuss किया गया है \ अब इस article मे function के type को discuss  करेगे |
User define function के type
किसी User define function मे argument और return statement का अहम् भूमिका होती है अतः argument और return statement के आधार User define function को चार भागो मे divined किया है |
1.User define function with no argument and no return type
2.User define function with no argument and return type
3.User define function with argument and return type
4.User define function with no argument and no return type
इन सभी types को इस article मे अच्छी तरह से discuss करेगे |
1. User define function with no argument and no return type
जब किसी User define function मे कोई भी argument को function call statement मे pass नहीं किया जाता है और User define function की definition मे कोई भी return statement नहीं होती है | तब User define function को no argument and no return value type का होता है |
इस type मे main() function मे केवल function को call किया जाता है | और बाकि के operation जैसे यूजर द्वारा input लेना , operation perform करना , आउटपुट display करना आदि function डेफिनिशन मे declare होता है |
इसका उदाहरन होता है :
#include <iostream>
#include<conio.h>
using namespace std;
// Function prototype (declaration)
void add( );
int main()
{
// function call
add(n1, n2);
getch();
}
// Function definition
void add( )
{
int n1, n2 ;
cout<<“Enter value1 : “;
cin >> n1;
cout<<“Enter value2 : “;
cin >> n2;
int output;
output = n1 + n2 ;
cout<<“Output : “<<output;
}
इस उदाहरन मे , function prototype मे निन्म पॉइंट्स consider किया जा सकता है :
function prototype मे function का type void है अतः function defition से कोई value return नहीं होती है |
function declartion मे कोई भी argument pass नहीं होता है |
main() function मे केवल function को call किया जाता है |
function definition मे , यूजर द्वारा value को input किया गया है | in value को add करके variable output मे assign किया जाता है |
और आउटपुट की value को display किया जाता है |
इसका आउटपुट होगा :
Enter value1 : 12
Enter value2 : 24
Output : 36
2. User define function with no argument and return type
जब किसी User define function मे कोई भी argument को function call statement मे pass नहीं किया जाता है और User define function की definition मे  return statement होता  है | तब User define function को no argument and return value type का होता है |
इस type मे main() function मे केवल function को call किया जाता है | function द्वारा return की value को variable मे assign कर ली जाती है | और बाकि के operation जैसे यूजर द्वारा input लेना , main operation perform करना  आदि function डेफिनिशन मे होता है |
इसका उदाहरन होता है :
#include <iostream>
#include<conio.h>
using namespace std;
// Function prototype (declaration)
int  add( );
int main()
{
int sum ;
// function call
sum = add();
cout<<“Output : “<<sum ;
getch();
}
// Function definition
int add( )
{
int n1, n2 ;
cout<<“Enter value1 : “;
cin >> n1;
cout<<“Enter value2 : “;
cin >> n2;
int output;
output = n1 + n2;
return output;
}
इस उदाहरन मे , function prototype मे निन्म पॉइंट्स consider किया जा सकता है :
function prototype मे function का type int है अतः function definition से return होनी वाली value का type integer है |
function declaration मे कोई भी argument pass नहीं होता है |
main() function मे केवल function को call किया जाता है | और function add () द्वारा return की गयी value को variable sum मे assign किया जाता है |
function definition मे , यूजर द्वारा value को input किया गया है | इन value को add करके variable output मे assign किया जाता है |
और आउटपुट की value को return किया जाता है |
इसका आउटपुट होगा :
Enter value1 : 35
Enter value2 : 24
Output : 59
3. User define function with  argument and return type
जब किसी User define function मे  argument को function call statement मे pass किया जाता है और User define function की definition मे  return statement होता  है | तब User define function को  argument and return value type का होता है |
इस type मे सभी operation जैसे यूजर द्वारा input लेना , function call और आउटपुट को print करना आदि main() function मे होता है | function definition मे केवल function मे perform होने वाले मुख्य operation के लॉजिक को लिखा जाता है |
इसका उदाहरन होता है :
#include <iostream>
#include<conio.h>
using namespace std;
// Function prototype (declaration)
int  add( int , int );
int main()
{
int sum ;
int n1, n2 ;
cout<<“Enter value1 : “;
cin >> n1;
cout<<“Enter value2 : “;
cin >> n2;
// function call
sum = add(n1 ,n2 );
cout<<“Output : “<<sum ;
getch();
}
// Function definition
int add( int a, int b )
{
int output;
output = a + b;
return output;
}
इस उदाहरन मे , function prototype मे निन्म पॉइंट्स consider किया जा सकता है :
function prototype मे function का type int है अतः function definition से return होनी वाली value का type integer है |
function declaration मे  argument pass होता है | अतः (int , int ) का मतलब मे function दो arguments pass होता है और इसका type integer होता है |
main() function मे , यूजर द्वारा data को input किया जाता है और बाद मे  function को call किया जाता है |
function add () द्वारा return की गयी value को variable sum मे assign किया जाता है |
function definition मे ,  इन value को add करके variable output मे assign किया जाता है |
और आउटपुट की value को return किया जाता है |
इसका आउटपुट होगा :
Enter value1 : 70
Enter value2 : 70
Output : 140
3. User define function with  argument and no return type
जब किसी User define function मे  argument को function call statement मे pass किया जाता है और User define function की definition मे  कोई भी  return statement नहीं होता  है | तब User define function को  argument and no return value type का होता है |
इस type मे सभी operation जैसे यूजर द्वारा input लेना , function call आदि main() function मे होता है | function defition मे केवल function मे perform होने वाले मुख्य operation के लॉजिक  और इस operation से प्राप्त value को display किया  जाता है |
इसका उदाहरन होता है :
#include <iostream>
#include<conio.h>
using namespace std;
// Function prototype (declaration)
void add( int , int );
int main()
{
int n1, n2 ;
cout<<“Enter value1 : “;
cin >> n1;
cout<<“Enter value2 : “;
cin >> n2;
// function call
add(n1 , n2 );
getch();
}
// Function definition
void add( int a, int b )
{
int output;
output = a + b;
cout<<“Output : “<<output ;
}
इस उदाहरन मे , function prototype मे निन्म पॉइंट्स consider किया जा सकता है :
function prototype मे function का type void  है अतः function definition से कोई भी value return नहीं हो रही  है |
function declaration मे  argument pass होता है | अतः (int , int ) का मतलब मे function दो arguments pass होता है और इसका type integer होता है |
main() function मे , यूजर द्वारा data को input किया जाता है और बाद मे  function को call किया जाता है |
function definition मे ,  इन value को add करके variable output मे assign किया जाता है |
और आउटपुट की value को display करे दिया जाता है |
इसका आउटपुट होगा :
Enter value1 : 90
Enter value2 : 60
Output : 150
इस article मे , function के type को discuss किया गया है अब आगे के article मे function से related advance topic जैसे garbage handling आदि को discuss करेगे |
Sbistudy

Recent Posts

four potential in hindi 4-potential electrodynamics चतुर्विम विभव किसे कहते हैं

चतुर्विम विभव (Four-Potential) हम जानते हैं कि एक निर्देश तंत्र में विद्युत क्षेत्र इसके सापेक्ष…

2 days ago

Relativistic Electrodynamics in hindi आपेक्षिकीय विद्युतगतिकी नोट्स क्या है परिभाषा

आपेक्षिकीय विद्युतगतिकी नोट्स क्या है परिभाषा Relativistic Electrodynamics in hindi ? अध्याय : आपेक्षिकीय विद्युतगतिकी…

4 days ago

pair production in hindi formula definition युग्म उत्पादन किसे कहते हैं परिभाषा सूत्र क्या है लिखिए

युग्म उत्पादन किसे कहते हैं परिभाषा सूत्र क्या है लिखिए pair production in hindi formula…

6 days ago

THRESHOLD REACTION ENERGY in hindi देहली अभिक्रिया ऊर्जा किसे कहते हैं सूत्र क्या है परिभाषा

देहली अभिक्रिया ऊर्जा किसे कहते हैं सूत्र क्या है परिभाषा THRESHOLD REACTION ENERGY in hindi…

6 days ago

elastic collision of two particles in hindi definition formula दो कणों की अप्रत्यास्थ टक्कर क्या है

दो कणों की अप्रत्यास्थ टक्कर क्या है elastic collision of two particles in hindi definition…

6 days ago
All Rights ReservedView Non-AMP Version
X

Headline

You can control the ways in which we improve and personalize your experience. Please choose whether you wish to allow the following:

Privacy Settings
JOIN us on
WhatsApp Group Join Now
Telegram Join Join Now