Learn C Language for Beginners | basic points, history, introduction, commands, keywords & identifiers, variable & constant and Data Types.

 



बिना Amazon Account बनाये Shopping करे नीचे दिये गये link पर 👍




  • History of C Language
  • Introduction of C Language
  • Basic commands of C Language
  • Keywords and Identifiers
  • Variable and Constants
  • Data Types



History of C Language 


        C language की आकर्षक कहाणी है| की C एक computer programming language है| जो की 1972 मे develop की है| Dennis Ritchie ने bell laboratories मे AT & T (American Telephone & Telegraph), ये USA मे स्थित है|


Introduction of C Language


         C एक general purpose programming languages है| जो की लगबग 50 साल से है| 

     operating system, windows और भी है| जैसे की python, interpreter, git, oracle database इन सब के लिये C का उपयोग किया गया है| 

      C एक अनेको गुनोसे प्रभावी design language है| ये एक निम्न स्तरीय language है| जो की अभी पढ़ना आसान है| तब भी मशीन कार्य से बहुत ही पास से जुड़ी हुई है|


Features of C Language

  • It is a simple language
  • Machine independent or portable language
  • Middle level programming language
  • Structured programming language
  • Feature of Memory management 
  • Compilation and execution of c language is fastest
  • Provides a Pointers
  • We can call Function with the function
  • It can easily adopt new features


C Basic Commands


print word 


कौनसी भी language सीखनी है| तो शुरुवात hello word से करे|

For example 

     #include<studio.h>

     int main()

     {

       printf("hello world!\n");

       return o;

      }

Output Hello World!


#include<studio.h>


      #include<studio.h> ये एक header file है| जो की output दर्षानेके के लिये  उपयोग किया जाता है| इसमे word print करणे के लिये printf function का उपयोग किया जाता है|


int main()


         Main() function ये program का entry point है| curly brackets {} function ki शुरुवात और अंत सुचित करता है| इसको code block भी कहा जाता है| bracket के अन्दर का statement दर्षाता है| की function मे क्या करना है|


printf function


         print function का उपयोग output display कर नेके लिये होता है| printf का उपयोग है display करना है screen पर values, character, string, etc.


\n escape equence character


       ये एक new line पर जाने के लिये उपयोग करते है| और escape sequence character कभिभी backslash \ से start करते है|


semicolon ; 


       ये statement Ka अंत दर्षाता है| हर statement के अंत मे semicolon लगाना जरूरी है| तभी statement Ka अंत होता है|


return 0;


         ये statement हमे main function () का अंत दर्षाता है| 0 का मतलब हमारा program सही तरीके से execute हो गया|अगर हम दुसरा number देते है| तो program failed दर्षाता है|



C Keywords and Identifiers 


        इस tutorial मे हम keyword और Identifiers के बारे मे जानेंगे| ये एक C programming  के syntax का part है| जो की reserved word है|


character set


        ये एक set है| alphabets, letters और special character का जो की language मे valid है|


alphabets set 


Uppercase : A B C ........................

Lowercase : a b c ........................

C variable और functions दोनो letter accept करता है| 


digits 


0 1 2 3 4 5 6 7 8 9


special character


special character in C programming

,     <     >    .     - 

(      )     ;      $     :

%    [     ]      #    ?

'      &    {       }    "

^      !     *       /    |

-       \      ~      +


white space characters 


Black space, newline, horizontal tab, carriage return or form feed 


C keywords 


      keywords ये predefined और reserve word है| जो की programming मे उपयोग होता है| इसका compiler के लिये special meaning है| keyword ये एक syntax का part है| ओ हम identifier मे उपयोग नहीं कर सकते|

For example 

      int money;

यहा int एक datatype keyword है| जो की money सुचित करता है| 

     C एक case sensitive language है| उसकी बजेसे lowercase मे लिखना जरूरी है| यहा नीचे पुरी keyword की list दी गयी है| जो की क ANSI C मे allowed है|


C Keyword

auto     double     int        struct 

break     else       long      switch 

case      enum  register typedef 

char     extern   return    union

continue for      signed     void 

do            if          static     while 

default   goto    sizeof    volatile

const      float     short  unsigned


C identifiers


      Identifiers refers to name given to entities such as variable, functions, structures, etc.

        Identifier ये unique होना जरूरी आवश्यक है| Identifiers unique name के लिये बनाया गया है|क्यूकी program execution के वक्त उसे पहचान सके|

For example 

        int money;

        double account Balance;

यहापे money और account balance identifier है| ये खयाल मे रखो की identifier name keyword से different होना जरूरी है| आप int को identifier करके उपयोग नहीं के सकते क्यूकी int एक keyword है|


Rules for Naming Identifiers 


1. C के uppercase letter, lowercase letter, digits and underscore ये एक valid identifiers है|

2. identifier का पहेला letter एक तो letter होना चाहिए या तो underscore होना चाहिए|

3. आप int, while keyword को identifier करके उपयोग करके उपयोग नहीं कर सकते| Identifier कितने समय तक रह सकता है| इसका कोही रूल नहीं है|

4. Identifier 31 character से long होगा तो compiler run करणेमे problem आ सकता है|

आप upper के सब रुल को देखकर identifier करके कौनसा भी नाम ले सकते है| पर identifier को अर्थपूर्ण नाम देना जरूरी है|



Click Here For Purchase to Amazon Products


Variable & constants 


   इस tutorial मे हम variable और variable naming के रुल और भिन्न word को constant कैसे create करे इसके बारे मे हम सीखेंगे|


Variable 


    C programming मे variable data store करनेके लिये एक container है| हर एक storage area दर्षानेके लिये unique name दिया जाता है| variable name सिर्फ एक symbolic representation है memory location का|


For example:

    int playerscore=95;

   

यहापे playerscore ये variable int का प्रकार है| यहा variable integer value 95 दी गयी है| variable की value हम बदल सकते हैं|


   Char Ch='a';

  //Same code 

    Ch='1';


Rules for naming a variable


1. Variable names सिर्फ letter,digits और underscore हो सकते है|

(both upper case and lower case)


2. Variable का पहला letter या तो letter होना चाहिए या underscore होना चाहिए|


3. Variable का नाम कितनी देर तक रह सकता है| इसका कोही नियम नही अगर variable का 31 word से जादा होगा तो compiler me समस्या आ सकती है|


Note : आपको variable को कभीभी meaningful नाम देना चाहिए| जैसे की example, firstname ये secondname से अच्छा variable है|


C एक strongly typed language है| मतलब variable का type declared होने पर हम उसको बदल नही सकते|


For Example

    int number=5;        //integer var

    number=5.5;            //error

    double number;     //error 


      यहापे number variable ये int का type है| आप इसको floating point value 5.5 नही दे सकते| वैसेही redefine data type के variable को आप double नहीं कर सकते| क्युकी आपको decimal values को को C मे store करना पडता है|की उसका type double और float declare करनेकी जरुरत होती है|


Literals


Literals are data used for representing fix values 

इसका हम सीधा कोडमे में उपयोग करते है|


For Example :

       1,2.5,'c',etc.


यहापे,1,2.5 और 'c' ये literal है| आप इसका different values मे इस term का उपयोग नही कर सकते|


Types of literals 


1. Integers


Integers ये एक numeric literal है| जो की बिना कोही fractional or exponential part के literal है| C programming मे three type के literals है|

     decimal(base 10)

      octal(base 8)

      hexadecimal (base 10)


For Example 

     decimal : 0,-9,22,etc.

     Octal : 021,077,033,etc.

     hexadecimal : 0x7f, 0x2a,         0x52,etc.


   C programming octal  0 से शुरूवात होती है| और hexadecimal 0x से होती है|


2. floating point literals


Floating point literal एक numeric literal है| जो की frational form or exponent form है|


For Example

      -2.0

       0.0000234

       -0.22E -5


Note : E -5 = 10      -5


3. Characters 


एक character literal create किया है| जो enclosing होता है| Single character मे जो की single quotation marks मे होता है|


For Example 

    'a', 'm', 'f', '2', '}', etc.


4. Escape sequences 


कभिभी C programming मे टाइप करना possible नही है| या special meaning होनेवाला letter का उपयोग करना आवश्यक है|


For Example

       newline,tab,question mark, etc 


इस order मे character का उपयोग करने के लिए escape sequence का उपयोग करते है|


For Example

      \n new line पर जाने के लिए उपयोग किया जाता है| 

      \ backslash ये normal way character है| जो की compiler द्वारा handle किया जाता है|

      नीचे दिए गए सब escape sequence character है|


Escape              Character   

    sequence 


 

\b                        backslash 

\f                         form feed 

\n                        newline

\r                         return 

\t                         horizontal tab

\v                        verticle tab 

\\                          backslash

\'           single quotation mark

\"        double quotation mark

\?                        question mark

\0                       Null Character

 

5. String literals 


String literals यानी double-quote mark मे जो sequence of character जैसे string literals कहा जाता है|


For Example;.

"good"              // String costant

   " "                  //Null string constant 

  "    "                //String constant of six white space 


"x"                 

  // string constant having a single character 

"Earth is round\n"

                        //Prints string with newline 


Constants 


जब हमको variable define करना है| तो value changed नही होती| तो उसके लिए हम constant keyword का उपयोग करते है|


For Example

       Const double PI=3.14;


      इस पर ध्यान दो हमने constant keyword add किया है| यहा PI एक symoblic constant है| इसकी value change नही होती ये constant रहती है|


   Const double PI=3.14;

    PI=2.9;              //error 


आप #preprocessor directive का उपयोग करके भी आप constant define कर सकते|





Data Types 


      इस tutorial मे हम Dataype के बारे मे जानने वाले है| की datatype का उपयोग कैसे और कहा किया जाता है| int, float, double, char, void इत्यादी ये सब dataypes आज हम सिखणे वाले है|


   C Programming मे हम datatype variable के लिये declared किया जाता है| variable ये datatype और size पर निर्भर होता है|


For Example

       int myvar;


यहापे myvar ये एक variable है| और int (integer) इसका datatype है| इस datatype की size 4 bytes है|


Basic Types 


   यहा common उपयोग किए जाने वाले datatype और quick access कीये जाने वाले जो की क Programming मे दिये है| ओ हम अभी जानने वाले है|



Types     size format specifier

                         

 int                4                       %d

float             4                        %f

char             1                       %c 

double         8                       %lf



      Integer ये whole number है| जो की उसमे दोनोमे zero है| integer मे positive or negative दोनोके values चलते सकते है|

For Example

       0, -5, 10

integer variable declared करने के लिये हम int का उपयोग करते है|

       int id;

यहापे id ये एक variable है और int (integer) उसका dataype है|

आप एक बार मे multiple variable declared कर सकते है|

       int id, age;

यहापे int( in bytes) is 4 यानी की 32 bits.



float and double 


      float and double को हम real number hold Karne के लिये भी उपयोग किया जाता है|

For Example 

       float salary;

       double price;


floating point number index दर्षानेके लिये उपयोग किया जाता है|

For Example

       float normalization factor=22.44ze2



Char


   Char dataype is used for declaring character type variable 

For Example

char test ='h';

यहापे character variable को size 1 byte है|जब variable एक character है उसके लिये हम char का उपयोग कर सकते है|




Void 


   Void ये एक incomplete type है| इसका meaning है| "nothing" और no type है void ये value retten नही करता|

For Example

     अगर function कुछ भी retten नाही करता तो उसका datatype void रहता है|


Short and Long


  आपको large number का उपयोग करनेकी आवश्यकता होगी तो आप specifier long का उपयोग कर सकते है|

      long a;

      long long b;

      long double c;

यहापे variable a and b को interger values बनाके store कर के रख सकते है|

अगर आपको यकीन हो तो small integer (E32, 767, +32, 767) ranges के लिये short  का उपयोग कर सकते है|

       short d;

अगर आपको variable की size को cheak करना है| तो आप sizeof() operator का उपयोग कर सकते है|


#Include<stdio.h>

int main()

{

short a;

long b; 

long long c;

long double d;

printf("size of short=%d                               bytes\n", sizeof(a));

printf("size of long=%d                                 bytes\n", sizeof(b));

printf("size of long long=%d                          bytes\n", sizeof(c));

printf("size of long double=%d                    bytes\n", sizeof(d));

return 0;

}


Singned and unsigned 


     ये C के  singned and unsigned type है| हम इसका उपयोग करके data storage के data को बदल सकते है|

For Example

       unsigned int x;

       int y;

यहापे variable सिर्फ zero और positive values को hold करता है क्यूकि हमने यहापे unsigned modifier का उपयोग किया है|

यहा int की size 4 bytes consider करने पर y -231 to 231-1 तक values hold करता है|

C Programming के other datatype defined कीये है|

    bool type 

    enumerated type 

    complex type 



टिप्पण्या

या ब्लॉगवरील लोकप्रिय पोस्ट

Childhood Memories | बचपन के दोस्त , बचपन जिगरी दोस्त , बचपन के किस्से , बचपन की यादे |

Is ServiceNow a good career in 2025? | IT Services, HR Services, Automation, Employee Services, Orders Products.

School Memories | स्कूल का सफर, स्कूल की यादे, स्कूल के शिक्षक, स्कूल के दोस्त |