JOIN us on
WhatsApp Group Join Now
Telegram Join Join Now

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

Categories: C Language in hindi

Common Programming Error in c language programs in hindi , c कंप्यूटर भाषा में त्रुटियाँ या एरर हिंदी में

c कंप्यूटर भाषा में त्रुटियाँ या एरर हिंदी में Common Programming Error in c language programs in hindi :-
इस article मे , हम operator error और function error को पढ़गे |
1. Forgetting the precedence of operators
किसी expression को solution operator के precedence पर निर्भर करता है |अगर प्रोग्रम्मेर initail stage पर हो तो operator के precendence को भूल सकते है |जैसे
if(sum=add() >100)
{
salary = sum+diwali bonus ;
}
इस उदाहरण मे , add() function का आउटपुट का compare 100 से होगे अगर add() की value 100 से ज्यादा होगी तब’1′ variable ‘sum’ मे assign हो जाएगी और अगर छोटी है तब sum की value मे ‘0’ assign होगी |जी की प्रोग्राम नहीं चाहता |
इस code से प्रोग्रम्मेर चाहता है की function add() की value sum मे assign हो |बाद sum की value ,100 से compare होगा |अगर condition सही है तब salary= sum+diwali bonus; perform होगा |
इस statement मे error इसलिए है क्योकि relation operator की precedence ,assignment operator से high होती है |इसलिए इस statement को निन्म तरह से लिख सकते है :-
if((sum=add()) >100)
{
salary = sum+diwali bonus ;
}
1. logical operator की precedence सभी arithmatic relation operator से कम होती है |
2.AND operator की precendence OR operator से ज्यादा होती है |
2. Ingnoring the order increment / decreament
कई बार प्रोग्रामर  pre और post  increment / decreament operator मे confuse हो जाते है |
जैसे
for(i=1;i<10;i++)
{
a[i]=10;
}
इस उदाहरन से ,i की value पहले increment होगा |बाद मे use होगा |
for(i=1;i<10;++i)
{
a[i]=10;
}
इस उदाहरन से ,i की value use होगी और बाद मे  increment होगा |
3.Forgeting or Declare Function Parameter
Mismatch in Actual or Formal Parameter :
किसी function मे ,actual और formal parameter mismatch common है |ये mismatch निम्न हो सकते है :-
1.Number: actual और formal parameter का number same होना चाहिए |इसका मतलब है calling function मे passed parameter को called function के definition मे parameter की सख्या same होनी चाहिये|
2. Type : actual और formal parameter माँ type भी same होना चाहिए |इसका मतल है  calling function मे passed parameter को called function के definition मे parameter का data type same होनी चाहिये|
उदहारण के लिए :
int add(int , int );
void main(0
{
int a=77 ,b=45;
add(a,b);
getch(0;
}
add(int c,int d)
{
int sum=c+d;
printf(“Output =%d”,sum);
}
इस उदहारण मे , two integer ‘a’ और ‘b’ को add function मे pass किया गया है |और function add () definition मे formal parameter भी integer है |
4.Non Declaration of function
जब किसी यूजर define function को main() function से पहले declare करना होता है |लेकिन कई बार लम्बे प्रोग्राम होने के कारन प्रोग्रामर function को declare करना भूल सकता है |
अगर function declare किया है लेकिन function declartion मे declare return type , function definition के return type से अलग होता है तब भी complier redefinition error message occur होता है जैसे
int add(int , int );
void main(0
{
int a=77 ,b=45;
f=add(a,b);
printf(“output =%d”,f);
getch(0;
}
add(int c,int d)
float div;
div =c/d;
return(div);
}
इस उदाहरण मे ,return value का data type float है और function declartion मे declare return type integer है इसलिए complier “redefinition” का error message देगा |
5.Missing address operator’&’ in scanf() statement
सभी non pointer variable मे data assign करने के लिए address operator का use किया जाता है |अगर progrmmer scanf() function मे address operator को भूल जाता है तो complier error message देता है |
जैसे i एक integer है तब
scanf(“%d”,i);   // Error message statememt
scanf(“%d”,&i);  // correct statement
6.Crossing Bounds of array
सभी C compiler मे , array के index ‘0’ से start होगा |लेकिन जब प्रोग्रामर array के index को ‘1’ से start करते तब output मे desired आउटपुट से अलग हो सकता है |
for(i=1;i<10;i++)
{
add=add+a[i];
}
इस उदाहरन में , a[0] element , addition मे भाग नहीं लेगा |इसलिए आउटपुट मे error message आ सकती है |
Using uninitialized Pointer
जब कभी uninitialized Pointer को use करते है तब इस pointer के garbage value को use करता है |इसलिए
uninitialized Pointer को use नहीं करना चाहिए |
7.Missing indirection and address operator
कभी कभी प्रोग्रामर indirection operator (*) and address operator (&) use नहीं करता है तब compiler error message देता है |common condition होती है :-
1. pointer variable मे address assignment मे |
int*a;
a=&d;
2.pointer variable की value को access करने के लिए ‘*’ को use करना |जैसे
printf(“pointer value =%d”,*a);
इसके अलावा कई common error होती है :-
1.wrong loop indexing
2.wrong loop termination
3. unending loop
4.Wrong use of relation operator
5.Trying to divide by zero
6.Truncation or roundoff error को सही नहीं करना |
इस प्रकार आप इन सभी common error को ध्यान मे रख कर किसी प्रोग्राम को bugs free कर सकते है |
Sbistudy

Recent Posts

सती रासो किसकी रचना है , sati raso ke rachnakar kaun hai in hindi , सती रासो के लेखक कौन है

सती रासो के लेखक कौन है सती रासो किसकी रचना है , sati raso ke…

21 hours ago

मारवाड़ रा परगना री विगत किसकी रचना है , marwar ra pargana ri vigat ke lekhak kaun the

marwar ra pargana ri vigat ke lekhak kaun the मारवाड़ रा परगना री विगत किसकी…

21 hours ago

राजस्थान के इतिहास के पुरातात्विक स्रोतों की विवेचना कीजिए sources of rajasthan history in hindi

sources of rajasthan history in hindi राजस्थान के इतिहास के पुरातात्विक स्रोतों की विवेचना कीजिए…

3 days ago

गुर्जरात्रा प्रदेश राजस्थान कौनसा है , किसे कहते है ? gurjaratra pradesh in rajasthan in hindi

gurjaratra pradesh in rajasthan in hindi गुर्जरात्रा प्रदेश राजस्थान कौनसा है , किसे कहते है…

3 days ago

Weston Standard Cell in hindi वेस्टन मानक सेल क्या है इससे सेल विभव (वि.वा.बल) का मापन

वेस्टन मानक सेल क्या है इससे सेल विभव (वि.वा.बल) का मापन Weston Standard Cell in…

3 months ago

polity notes pdf in hindi for upsc prelims and mains exam , SSC , RAS political science hindi medium handwritten

get all types and chapters polity notes pdf in hindi for upsc , SSC ,…

3 months 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