Pages

Thursday, 18 February 2016

Understand Grammar of C


Understand Grammar of C

As human need a language to communicate with another human. Same in computer Science there is a language that helps to communication between human and computer. Here we are using C Language from many present language of Computer. 

C language and English Language are not different, that means if you want learn English then you should learn first the alphabet or characters used in English, then integrate these alphabets to make form, which in turn are integrated to make sentences and these sentences make paragraphs. Learning C is similar and easy like English.

Therefore we should learn grammar of C instead of straight away learning how to write programs which are following here?

Steps in learning English Language:

ALPHABETS > WORDS > SENTENCES > PARAGRAPH

Steps in Learning C Language

ALPHABETS, DIGITS AND SPECIAL SYMBOLS >CONSTANT ,VARIABLE,KEYWORD > INSTRUCTION > PROGRAM

Character Set of C Programming

Here, character means any digit, alphabet and special symbol that used to make necessary segments of program. Following table are given which express the valid alphabet, digit and special Symbols that allowed by C.

Alphabets
A,B …………………..Y,Z
A,b,……………….….y,z
Digit
0,1,2,3,4,5,6,7,8,9
Special Symbols
~ ‘ ! @ # % ^ & * ( ) _ - + = \ | { } [ ] : ;      < >  ,  .  ?  /
Figure1

C’s Character what make

When we combine properly to alphabet, numbers and special symbols then it form constants, variable and keywords. The way alphabets form words in English. Now you think what are constants, variables and keyword?


In passage of text, individual words and punctuation mark are called tokens, similarly in c program the smallest individual units are called C tokens. There are 6 types of token are present in C which are following.

Implementing and Running A "C" Program / सी प्रोग्राम का क्रियान्वयन

C प्रोग्राम का क्रियान्वयन

सी भाषा मे प्रोग्राम को क्रियान्वित करने से संबन्धित जानकारी हम नीचे दिये चार चरणो मे बता रहे है जिन्हे आप ध्यान से पढे, इसके अलावा वो उपयोगकर्ता जो लिनक्स पर काम करते हैं उनके लिए अलग आर्टिकल के माध्यम से बताया गया हैं की लिनक्स मे कैसे सी का प्रोग्राम क्रियान्यवित करते हैं।

पहला चरण :

 1 -  सबसे पहले आपको औब्जैकटिव यानि किस प्रकार का प्रोग्राम बना हैं पता होना चाहिए जो आपके कंपनी से आपको मिलेगा, अगर आप विद्यार्थी हैं तो निश्चित ही आपके शिक्षक आपको प्रोग्राम देंगे।

2-  इसके बाद प्रोग्राम लिखने के लिए एडिटर का चयन करे, कई कंपाइलर मे एडिटर पहले से ही होता हैं अगर न हो तो आप notepad मे भी प्रोग्राम लिख सकते हैं।

3-  इसके बाद प्रोग्राम लिखने के बाद अपने प्रोग्राम को सेव करे पर ध्यान रखे आप जो प्रोग्राम सेव करने जा रहे हैं उसका एक्स्टेंसन नेम  “॰C “ होना चाहिए। 

4-  अब इस सूरक्षित किए गए प्रोग्राम को सोर्स कोड कहेंगे।

दूसरा चरण :

1-  अब बनाए गए उस प्रोग्राम को कंपाइल करना होगा। कंपाइल वह प्रक्रिया हैं जो आपके द्वारा बनाए गए प्रोग्राम को इनपुट के रूप मे लेकर उसे मशीन के समझने योग्य भाषा मे तब्दील कर देती हैं।

2-  अगर आप बोलार्ड का कंपाइलर उपयोग कर रहे हैं तो कोंपईल करने के लिए Alt + F9 प्रेस करे। 

3-  इसके बाद कोंपईलर आपके प्रोग्राम मे error को चेक करेगा। अगर कोई भी error नहीं है तो वह object फ़ाइल का निर्माण करेगा अन्यथा आपको मैसेज विंडो के माध्यम से error की जानकारी देगा।

तीसरा चरण :

1-  अगर कंपाइलर द्वारा आपके प्रोग्राम मे कोई error बताता हैं तब आपको अपने प्रोग्राम को एक बार पुनः पढ़ना होगा जिससे error को आप सुधार सके। 

2-  एरर को सुधारने के बाद एक बार फिर आप अपने प्रोग्राम को कंपाइल करेंगे।

3-  अगर प्रोग्राम बिना एरर का हैं तब आपके प्रोग्राम मे जरूरी लाइब्रेरीज़ को सम्मालित किया जाएगा।

चौथा चरण 

1-  एरर को चेक करने के बाद आपके प्रोग्राम मे जो हेडर फाइल आपने सम्मालित किया था। उसे आपके प्रोग्राम के साथ लिंक किया जाएगा।

2-  जो फंक्शन आपके प्रोग्राम मे उपयोग किए गए हैं उनकी परिभाषाए या उनकी लाइब्रेरीज़ को आपके प्रोग्राम मे जोड़ा जाएगा।

3-  यह काम लिंकर नाम के यूनिट के द्वारा किया जाता हैं।

पंचवा चरण :

1-  इसके बाद एक बार फिर आपके प्रोग्राम को चेक किया जाएगा की आपके प्रोग्राम मे कहि रन-टाइम एरर तो नहीं हैं।

2-  अगर कोई रन-टाइम एरर पाई जाती हैं तो यूजर को मैसेज के द्वारा सूचित किया जाएगा।

3-  और इसके बाद यूजर अपने प्रोग्रा को फिर से जांच करेगा।

4-  अगर आपके प्रोग्राम मे कोई रन- टाइम एरर नहीं तो आप का प्रोग्राम क्रियान्वित होने के लिए तैयार हैं।

 

Popular Posts