JOIN us on
WhatsApp Group Join Now
Telegram Join Join Now

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

Categories: C Language in hindi

Common Programming Errors in hindi in c language , सामान्य एरर c कंप्यूटर भाषा में हिंदी में

सामान्य एरर c कंप्यूटर भाषा में हिंदी में Common Programming Errors in hindi in c language :-
अब तक हमने C languge के सभी basic syntax ( data type,pointer,function और array ) को पढ़ा |लेकिन जब हम किसी प्रोग्राम को पढ़ते तब bugs और error को पहचाना मुश्किल होता है |लेकिन Common Programming Errors-Part 1 और Common Programming Errors-Part 2 मे ,common error के types को पढ़गे |जिसे पढ़कर , आप c प्रोग्राम के error को easily से पहचान सकते है|
  1. Missing Semicolon
    C language मे सभी statement semicolon से terminate होती है |अगर कोई semicolon नहीं होता है तब complier confuse हो जाता है और error message आ जाता है |
    उदहारण के लिए :
    a=a+b
    c=c-d;
    इस उदहारण मे complier second line को भी first line का part  मान लेता है |इसलिए c भी एक variable की तरह treat होता है और कोम्प्लिएर undefined name की error दे देता है |
    इस उदाहरण मे , message और location  की location गलत है इसलिए error message second line के लिए होता है |

2.Misuse of Semicolon
दूसरी बड़ी मिस्टेक होती है semicolon का misuse|उदाहरण के लिए :
while(i<12);
{
printf(“Good Morning”);
i++;
}
इस case मे ,कोई error message produce नहीं होता है क्योकि ये syntactically सही है |लेकिन इस तरह के error ,syntax error से भी worst होती है |लेकिन अगर प्रोग्रामर यही mistake for loop के साथ करता है |कोम्प्लिर एक बार ही execute होगा |क्योकि इसमें increment एक ही बार होगा |जैसे
for(i=0;i<12;i++);
{
printf(“Good Morning “);
}
इस प्रकार की error ,syntax error से भी worst आउटपुट देती है |जैसे assignment operator(=) और Equal (==) मे confusion|जैसे
if(i=1)
{
i++;
}
इस उदहारण मे, i की value 1 से initial होगी |बाद मे increament होगा |लेकिन इस statement से कोई relation operation perform नहीं होगा|

2.Missing Braces
ये बहुत common error होती है | प्रोग्रामर कई बार brace को close करना भूल जाता है लेकिन complier हमेशा ओपनिंग brace का number जरुर रखता है | और अगर प्रोग्रम्मर किसी क्लोज brace को भूल जाता है तब complier इसे नोटिस करता है और unexpected आउटपुट देता है |
बरसे से दूसरी बड़ी error होती की जब दो या दो से अधिक statement block को लिखा जाता है तब उन blocks को बbraces मे closeकिया जाता है |
जैसे
printf(“data”);
scanf(“%d %d”,&a , &b);
if(a<b)
printf(“a is smaller than b “);
printf(“a is less than b”);
printf(“Have a  nice day”);
इस उदाहरण मे अगर condition a<b सही होगी तब a is smaller than b print होगा |लेकिन इस code से a is smaller than b , a is less than b और Have a nice day एक साथ print होगा |
इसका सही code है :-
printf(“data”);
scanf(“%d %d”,&a , &b);
if(a<b)
{
printf(“a is smaller than b “);
}
printf(“a is less than b”);
printf(“Have a  nice day”);

4.Missing Quotes
जब हम quotes को भूल जाते tab बड़ी प्रॉब्लम create हो सकती है |string को charecter variable से अलग करने quotes का use किया जाता है| अगर quotes नहीं use किये जाते तब string एक chrecter variable की तरह कार्य करता है |
जैसे
if(reply== no)
{
city= A;      // A is constant variable here
}
else
{
city=’B’;   // B is string here
}

5.Improper Comment Character
C language मे ,सभी comment /* और */ से close होती है |in syntax के बीच लिखे statement को compiler compile नहीं करता है |अगर  प्रोग्रामर */ भूल जाता है तब comment भी comand की treat होता है |इसलिए इसका error आ सकता है |
उदाहरण के लिए
a=b; /* value of b assign into a */
if(a==c) /* condition check*/

c language मे nested comment allow नहीं है |उदाहरण के लिए
/* assignment begin
TEMP=A;
A=B;
B=TEMP;
/* PRINTING START*/
printf(“Value of a or b are %d or %d”,A B); */

इस उदाहरण मे , PRINTING START comment की तरह treat नहीं होगा क्योकि अभी ओपनिंग comment /* का क्लोज होना जरुरी है |
यहा पर /* assignment begin
TEMP=A;
A=B;
B=TEMP;
/*
एक comment है |
और
*/ printf(“Value of a or b are %d or %d”,A B); */ दूसरा comment है |
इसका सही from है :-
/* assignment begin*/
/*TEMP=A;*/
/*A=B;*/
/*B=TEMP;*/
/* PRINTING START*/
/*printf(“Value of a or b are %d or %d”,A B); */

6.Undeclare variable
किसी भी variable को c प्रोग्रम मे  use करने से पहले declare करना जरुरी है |

7.Misusing quotes
किसी प्रोग्रामर को ये ध्यान रखना चाहिए की single quotes केवल charecter को handle करने के लिए किया जाता है |किसी string को handel करने के लिए double quotes को use करते है |
उदाहरण के लिए
char a[16];
char b[1];
a=”Parth”;
b=’w’;

Identify Error

#include<conio.h>
#include<stdio.h>
void main()
{
int a,b,c;
float m,d;
printf(“Data”);
scanf(“%d %d”,&a &b);
c=a+b
e=a-b;
d=a/b;
m=a*b
printf(output of a+b is %d, c);
printf(“output of a-b is %d”, e)
printf(output of a*b is %d, m);
printf(‘output of a\b is %f”, c);
getch();
}

इस article मे syntax error को पढ़ा |अब अगले article मे operation और function related error को पढेगे |

Sbistudy

Recent Posts

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

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

1 day ago

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

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

1 day 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