हिंदी माध्यम नोट्स
C99 – Feature (Part -3) : function related modification in c language in hindi , फंक्शन सम्बंधित मॉडिफिकेशन
C 99 मे function को implement करके के तरीके मे काफी changes आये है |इसमें include होता है :-
1.Default of int rule को हटा दिया गया है |
2.Implicit function declaration को भी हटा दिया गया है |
3.return function की complusy को भी हटा दिया गया है |
4. function inline facility1. Elimination of Default of int rule
.जब किसी function को declare किया जाता है |इसका syntax होता है :
return type function name (parameter details);
इस syntax मे :
return type : ये declare करता है की function से किसी प्रकार के data type return होगा |
function name : ये function का नाम है|
parameter details: ये सेक्शन मे function मे pass होने वाले variable के data type को declare किया जाता है |
C language मे , अगर return type को declare नहीं करते है तब इसका default return type integer होगा | जैसे
#include<stdio.h>
#include<conio.h>
add(int , int );
void main()
{
int a ,b,c;
printf(“Data”);
scnaf(“%d %d”,&a &b);
c=add(a,b);
printf(“Sum = %d”, c);
getch ();
}
add (int e,int f)
{
int sum;
sum=e+f;
return(sum);
}
इस उदाहरण मे , function add() के declaration मे return type को declare नहीं किया गया है |add() function से integer return हो रही |और function का default return type integer type है अतः ये प्रोग्राम बिना किसी error के run हो जाता है |
लेकिन अगर इस function को C99 मे run करे तो error आ जाती है |इस error को दूर करने के लिए function के declaration मे return type को int से declare करना पड़ता है |अतः
प्रोग्राम :- C99
#include<stdio.h>
#include<conio.h>
int add(int , int );
void main()
{
int a ,b,c;
printf(“Data”);
scnaf(“%d %d”,&a &b);
c=add(a,b);
printf(“Sum = %d”, c);
getch ();
}
int add (int e,int f)
{
int sum;
sum=e+f;
return(sum);
}
इसके अलावा default integer का rule function parameter मे भी omit कर दिया गया है |क्योकि अगर किसी function parameter को function declaration मे उसके qualifier से declare किया जाता है |तब उस parameter का default type integer होता है |c language मे usually तीन qualifier मुख्य होते है |
1.Constant: ये भी एक नार्मल variable ही होते है लेकिन इनके value constant होती है यानि change नहीं हो सकती है |इसका syntax const होता है |
2.Register : ये भी नार्मल variable होते है लेकिन ये memory मे store नहीं होते है बल्की कंप्यूटर memory बने register मे store होते है |इसका syntax register होता है |
3.volatile: जब किसी variable को volatile declare किया जाता है तब इसकी value को प्रोग्राम मे change नहीं कर सकते है | इसे केवल सिस्टम से change हो सकता है |
उदाहरण के लिए :-
C language मे ,
#include<stdio.h>
#include<conio.h>
int mul( );
void main()
{
int c,a,b;
printf(“Data”);
scnaf(“%d %d”,&a &b);
c=mul(a,b);
printf(“Multiplication = %d”, c);
getch ();
}
mul ( register e, register f)
{
int mul;
mul =e*f;
return(mul);
}
इस उदहारण मे , function definition मे variable को register declare किया गया है अतः इसका default type integer भी है लेकिन ये function C99 मे run हो सकता है |
इसके लिए निन्म modification करना पड़ता है :-
C99 language मे ,
#include<stdio.h>
#include<conio.h>
int mul( );
void main()
{
int c,a,b;
printf(“Data”);
scnaf(“%d %d”,&a &b);
c=mul(a,b);
printf(“Multiplication = %d”, c);
getch ();
}
mul ( register int e, register int f)
{
int mul;
mul =e*f;
return(mul);
}
int sub(int e,int f)
int sub(int e,int f)
inline void div (int e,int f)
Recent Posts
Question Tag Definition in english with examples upsc ssc ias state pcs exames important topic
Question Tag Definition • A question tag is a small question at the end of a…
Translation in english grammer in hindi examples Step of Translation (अनुवाद के चरण)
Translation 1. Step of Translation (अनुवाद के चरण) • मूल वाक्य का पता करना और उसकी…
Report Writing examples in english grammer How to Write Reports explain Exercise
Report Writing • How to Write Reports • Just as no definite rules can be laid down…
Letter writing ,types and their examples in english grammer upsc state pcs class 12 10th
Letter writing • Introduction • Letter writing is an intricate task as it demands meticulous attention, still…
विश्व के महाद्वीप की भौगोलिक विशेषताएँ continents of the world and their countries in hindi features
continents of the world and their countries in hindi features विश्व के महाद्वीप की भौगोलिक…
भारत के वन्य जीव राष्ट्रीय उद्यान list in hin hindi IAS UPSC
भारत के वन्य जीव भारत में जलवायु की दृष्टि से काफी विविधता पाई जाती है,…