- What is C?
: C is a programming language developed at AT & T’s Bell Laboratories of USA in 1972 by Dennis Ritchie.
: Any programming Language can be divided in to two categories.
- Problem oriented (High level language)
- Machine oriented (Low level language)
But C is considered as a Middle level Language.
- : C is modular, portable, reusable.
1. सी क्या है?
एक प्रोग्रामिंग भाषा है।
सी 1 9 72 में डेनिस रिची द्वारा संयुक्त राज्य अमेरिका के एटी एंड टी के बेल प्रयोगशालाओं में विकसित एक प्रोग्रामिंग भाषा है।
किसी भी प्रोग्रामिंग भाषा को दो श्रेणियों में विभाजित किया जा सकता है।
समस्या उन्मुख (उच्च स्तरीय भाषा)
मशीन उन्मुख (निम्न स्तर की भाषा) लेकिन सी को मध्य स्तर की भाषा माना जाता है।
सी मॉड्यूलर, पोर्टेबल, पुन: प्रयोज्य है।
2. Feature of C Program
- Structured language
- It has the ability to divide and hide all the information and instruction.
- Code can be partitioned in C using functions or code block.
- C is a well structured language compare to other.
- General purpose language
- Make it ideal language for system programming.
- It can also be used for business and scientific application.
- ANSI established a standard for c in 1983.
- The ability of c is to manipulate bits,byte and addresses.
- It is adopted in later 1990.
- Portability
- Portability is the ability to port or use the software written .
- One computer C program can be reused.
- By modification or no modification.
- Code Re-usability &
Ability to customize and extend
- A programmer can easily create his own function
- It can can be used repeatedly in different application
- C program basically collection of function
- The function are supported by ‘c’ library
- Function can be added to ‘c’ library continuously
- Limited Number of Key Word
- There are only 32 keywords in ‘C’
- 27 keywords are given by ritchie
- 5 is added by ANSI
- The strength of ‘C’ is lies in its in-built function
- Unix system provides as large number of C function
- Some function are used in operation .
- Other are for specialized in their application
2. सी कार्यक्रम की सुविधा
संरचित भाषा
इसमें सभी सूचनाओं और निर्देशों को विभाजित करने और छिपाने की क्षमता है।
संहिता को फंक्शंस या कोड ब्लॉक का उपयोग करके सी में विभाजित किया जा सकता है।
सी एक अच्छी तरह से संरचित भाषा दूसरे की तुलना में है।
सामान्य उद्देश्य भाषा
सिस्टम प्रोग्रामिंग के लिए इसे आदर्श भाषा बनाएं।
इसका उपयोग व्यापार और वैज्ञानिक अनुप्रयोग के लिए भी किया जा सकता है।
एएनएसआई ने 1 9 83 में सी के लिए एक मानक स्थापित किया।
सी की क्षमता बिट्स, बाइट और पतों में हेरफेर करना है।
इसे बाद में 1 99 0 में अपनाया गया।
पोर्टेबिलिटी
पोर्टेबिलिटी लिखित सॉफ्टवेयर का पोर्ट या उपयोग करने की क्षमता है।
एक कंप्यूटर सी प्रोग्राम का पुन: उपयोग किया जा सकता है।
संशोधन या कोई संशोधन द्वारा।
कोड पुन: उपयोगिता और अनुकूलित और विस्तार करने की क्षमता
एक प्रोग्रामर आसानी से अपना काम बना सकता है
इसे विभिन्न अनुप्रयोगों में बार-बार उपयोग किया जा सकता है
सी कार्यक्रम मूल रूप से समारोह का संग्रह
फ़ंक्शन ‘सी’ लाइब्रेरी द्वारा समर्थित है
फंक्शन को ‘सी’ लाइब्रेरी में लगातार जोड़ा जा सकता है
कुंजी शब्द की सीमित संख्या
‘सी’ में केवल 32 कीवर्ड हैं
27 कीवर्ड रिची द्वारा दिए जाते हैं
5 एएनएसआई द्वारा जोड़ा गया है
‘सी’ की ताकत इसके अंतर्निर्मित कार्य में निहित है
यूनिक्स सिस्टम बड़ी संख्या में सी फ़ंक्शन प्रदान करता है
कुछ फ़ंक्शन ऑपरेशन में उपयोग किए जाते हैं।
अन्य उनके आवेदन में विशिष्ट हैं …
3. C program structure
pre-processor directives
global declarations
main()
{
local variable deceleration
statement sequences
function invoking
}
4. C Keywords Keywords are the words whose meaning has already been explained to the C compiler. There are only 32 keywords available in C. The keywords are also called ‘Reserved words’.
4. सी कीवर्ड
कीवर्ड वे शब्द होते हैं जिनका अर्थ सी संकलक को पहले ही समझाया गया है। सी में केवल 32 कीवर्ड उपलब्ध हैं। कीवर्ड को ‘आरक्षित शब्द’ भी कहा जाता है।
auto double int struct
break else long switch
case enum register typedef
char extern return union
const float short unsigned
continue for signed void
default goto sizeof volatile
do if static while
5. C Character Set
A character denotes any alphabet, digit or special symbol used to represent information. Following are the valid alphabets, numbers and special symbols allowed in C.
एक चरित्र सूचना का प्रतिनिधित्व करने के लिए उपयोग किए गए किसी भी वर्णमाला, अंक या विशेष प्रतीक को दर्शाता है। सी में मान्य वर्णमाला, संख्याएं और विशेष प्रतीक निम्नलिखित हैं।
- Alphabets – A, B, ….., Y, Z a, b, ……, y, z
- Digits – 0, 1, 2, 3, 4, 5, 6, 7, 8, 9
- Special symbols –
~ ‘ ! @ # % ^ & * ( ) _ – + = | \ { }
[ ] : ; ” ‘ < > , . ? /
6. Rules for Writing, Compiling and Executing the C program
- C is case sensitive means variable named “COUNTER” is different from a variable named “counter”.
- All keywords are lowercased.
- Keywords cannot be used for any other purpose (like variable names).
- Every C statement must end with a ;. Thus ;acts as a statement terminator.
- First character must be an alphabet or underscore, no special symbol other than an underscore, no commas or blank spaces are allowed with in a variable, constant or keyword.
- Blank spaces may be inserted between two words to improve the readability of the statement. However, no blank spaces are allowed within a variable, constant or keyword.
- Variable must be declared before it is used in the program.
- File should be have the extension .c
- Program need to be compiled before execution.
सी केस संवेदनशील है जिसका नाम “काउंटर” नामक चर “काउंटर” नामक चर से अलग है।
सभी कीवर्ड कम हो गए हैं।
कीवर्ड का उपयोग किसी अन्य उद्देश्य (जैसे परिवर्तनीय नाम) के लिए नहीं किया जा सकता है।
प्रत्येक सी कथन एक साथ समाप्त होना चाहिए; इस प्रकार, एक कथन टर्मिनेटर के रूप में कार्य करता है।
पहला अक्षर एक वर्णमाला या अंडरस्कोर होना चाहिए, अंडरस्कोर के अलावा कोई विशेष प्रतीक नहीं, एक चर, स्थिर या कीवर्ड में कोई कॉमा या रिक्त स्थान की अनुमति नहीं है।
कथन की पठनीयता में सुधार के लिए रिक्त स्थान दो शब्दों के बीच डाला जा सकता है। हालांकि, एक परिवर्तनीय, स्थिर या कीवर्ड के भीतर कोई रिक्त स्थान की अनुमति नहीं है।
प्रोग्राम में इस्तेमाल होने से पहले परिवर्तनीय घोषित किया जाना चाहिए।
फ़ाइल में एक्सटेंशन होना चाहिए। सी
निष्पादन से पहले कार्यक्रम को संकलित करने की आवश्यकता है।
7. Data types & Placeholders
- C has 5 basic built-in data types.
- Data type defines a set of values that a variable can store along with a set of operations that can be performed on it.
- A variable takes different values at different times.
- General form for declaring a variable is:
type name; - An example for using variables comes below:
सी में 5 बुनियादी अंतर्निहित डेटा प्रकार हैं।
डेटा प्रकार उन मानों के एक सेट को परिभाषित करता है जो एक चर के संचालन के सेट के साथ स्टोर कर सकते हैं जिसे उस पर किया जा सकता है।
एक चर अलग-अलग समय पर अलग-अलग मान लेता है।
एक चर घोषित करने के लिए सामान्य रूप है:
नाम लिखो;
चर का उपयोग करने के लिए एक उदाहरण नीचे आता है:
#include<stdio.h>
main()
{
intsum;
sum=12;
sum=sum+5;
printf("Sum is %d",sum);
}
printf function will print the following:
Sum is 17
In fact %d is the placeholder for integer variable value that its name comes
after double quotes.
printf फ़ंक्शन निम्न प्रिंट करेगा:
योग 17 है
वास्तव में% d पूर्णांक परिवर्तनीय मान के लिए प्लेसहोल्डर है जिसका नाम डबल कोट्स के बाद आता है।
- Common
data types are:
- int – integer
- char – character
- long – long integer
- float – float number
- double – long float
- Other placeholders are:
Placeholders Format
%c Character
%d Signed decimal integer
%i Signed decimal integer
%e Scientific notation[e]
%E Scientific notation[E]
%f Decimal floating point
%o unsigned octal
%s String of character
%u unsigned decimal integer
%x unsigned Hexadecimal (lower)
%X unsigned Hexadecimal (upper)
%p dispaly a pointer
%% print a %
8. Control characters (Escape sequences)
Certain non printing characters as well as the backslash () and the apostrophe(‘), can be expressed in terms of escape sequence.
कुछ गैर प्रिंटिंग वर्णों के साथ-साथ बैकस्लैश () और एस्ट्रोफ़े (‘) को बचने के क्रम में व्यक्त किया जा सकता है।
- \a – Bell
- \n – New line
- \r – Carriage return
- \b – Backspace
- \f – Formfeed
- \t – Horizontal tab
- \” – Quotation mark
- \v – Vertical tab
- \’ – Apostrophe
- \\ – Backslash
- \? – Question mark
- \0 – Null
9. Receiving input values from keyboard
scanf function used to receiving input from keyboard.
General form of scanf function is :
scanf फ़ंक्शन कीबोर्ड से इनपुट प्राप्त करने के लिए उपयोग किया जाता है।
स्कैनफ फ़ंक्शन का सामान्य रूप है:
1. scanf("Format string",&variable,&variable,...);
Format string contains
placeholders for variables that we intend to receive from keyboard. A & sign
comes before each variable name that comes in variable listing. Character
strings are exceptions from this rule. They will not come with this sign before
them.
Note: You are not allowed to insert any additional characters in format string other than placeholders and some special characters. Entering even a space or other undesired character will cause your program to work incorrectly and the results will be unexpected. So make sure you just insert placeholder characters in scanf format string. The following example receives multiple variables from keyboard.
स्वरूप स्ट्रिंग में चर के लिए प्लेसहोल्डर्स होते हैं जिन्हें हम कीबोर्ड से प्राप्त करना चाहते हैं। ए और साइन वेरिएबल लिस्टिंग में आने वाले प्रत्येक चर नाम से पहले आता है। चरित्र तार इस नियम से अपवाद हैं। वे उनके सामने इस हस्ताक्षर के साथ नहीं आएंगे।
नोट: प्लेसहोल्डर्स और कुछ विशेष पात्रों के अलावा प्रारूप स्ट्रिंग में आपको कोई अतिरिक्त वर्ण डालने की अनुमति नहीं है। एक स्थान या अन्य अवांछित चरित्र दर्ज करना आपके प्रोग्राम को गलत तरीके से काम करने का कारण बनता है और परिणाम अप्रत्याशित होंगे। तो सुनिश्चित करें कि आप केवल स्कैनफ प्रारूप स्ट्रिंग में प्लेसहोल्डर वर्ण डालें। निम्नलिखित उदाहरण कीबोर्ड से एकाधिक चर प्राप्त करता है।
floata;
intn;
scanf("%d%f",&n,&a);
Pay attention that scanf function has no error checking capabilities built in it. Programmer is responsible for validating input data (type, range etc.) and preventing errors
ध्यान दें कि स्कैनफ़ फ़ंक्शन में इसमें निर्मित कोई त्रुटि जांच क्षमता नहीं है। प्रोग्रामर इनपुट डेटा (प्रकार, रेंज इत्यादि) को वैध करने और त्रुटियों को रोकने के लिए ज़िम्मेदार है
Print Hello World – C Language Programming
Program in C Language to print “Hello World”
Statement - Print Hello World
#include <stdio.h>
#include <conio.h>
voidmain()
{
clrscr();
printf("Hello world\n");
getch();
}
Print Integer Value – C Language Programming
Program in C language to print an integer value
Statement - Print Integer
#include <stdio.h>
#include <conio.h>
voidmain()
{
inta;
clrscr();
printf("Enter an integer\n");
scanf("%d",&a);
printf("Integer that you have entered is %d\n",a);
getch();
}
Addition of Two Number – C Language Programming
Program in C language to addition of two integer value.
Statement - Addition of two number
#include <stdio.h>
#include <conio.h>
voidmain()
{
inta,b,c;
clrscr();
printf("Enter two numbers to add\n");
scanf("%d%d",&a,&b);
c=a+b;
printf("Sum of entered numbers = %d\n",c);
getch();
}

aap ye post read kro aur jo bhi quary ho comment me likhe
LikeLike