C-and-C++/C4/Understanding-Pointers/Gujarati
From Script | Spoken-Tutorial
Time' | Narration |
00:02 | C અને C++ માં પોઇન્ટર પરના સ્પોકન ટ્યુટોરીયલમાં તમારું સ્વાગત છે |
00:07 | આ ટ્યુટોરીયલમાં આપને શીખીશું, |
00:09 | પોઈન્ટર્સ. |
00:10 | પોઈન્ટર્સ બનાવવું. |
00:12 | અને પોઈન્ટર્સ ઉપર ઓપરેશનો કરવું. |
00:15 | આપણે આ ઉદાહરણ મારફતે કરીશું. |
00:18 | આ ટ્યુટોરીયલ રેકોર્ડ કરવા માટે, હું ઉપયોગ કરું છું
Ubuntu OS આવૃત્તિ 11.10, ubuntu ઉપર gcc અને g++ કમ્પાઈલર v4.6.1 . |
00:32 | ચાલો પોઈન્ટર્સ ના પરિચય સાથે શરૂ કરીએ. |
00:35 | પોઇન્ટર મેમરી માં સ્થાનોને નિર્દેશ કરે છે.
|
00:39 | પોઈન્ટર્સ મેમરી એડ્રેસ સંગ્રહ કરે છે.
|
00:42 | તે, તે અડ્રેસ પર સંગ્રહ થયેલ વેલ્યુ પણ આપે છે. |
00:45 | હવે ચાલો પોઈન્ટર્સ ઉપર ઉદાહરણ જોઈએ. |
00:49 | નોંધ લો કે આપની ફાઈલનું નામ pointer_demo.c છે. |
00:54 | ચાલો હવે કોડ મારફતે જઈએ. |
00:57 | આ આપણી હેડર ફાઈલ stdio.h તરીકે છે. |
01:01 | આ આપણું મેઈન ફન્કશન છે. |
01:03 | અહીં આપણી પાસે લોંગ ઈન્ટીજર num છે, જેમાં 10 વેલ્યુ અસાઇન થઇ છે. |
01:09 | પછી આપણે પોઈન્ટર ptr જાહેર કર્યું છે. |
01:13 | Asterisk sign is used to declare a pointer. |
01:16 | This pointer can point to type long int. |
01:20 | In the printf statement ,Ampersand is used for retrieving memory address of the variable. |
01:28 | So ampersand num will give the memory address of num. |
01:34 | This statement will print the address of the variable num. |
01:38 | Over here ptr stores the address of num. |
01:48 | This statement will print the address of ptr. |
01:46 | Size of function will give the size of ptr. |
01:49 | This is will give the value of ptr. |
01:52 | That is the memory address of num. |
01:55 | And here asterisk ptr will give the value at the address.
' |
02:00 | So using asterik will not give the memory address. |
02:03 | Instead it will give the value. %ld is the format specifier for long int. |
02:11 | Now let us execute the program. |
02:14 | Open the terminal window by pressing ctrl+alt+t keys simultaneously on your keyboard. |
02:22 | To compile type: |
02:23 | gcc pointer_demo.c -o point |
02:33 | Press Enter |
02:35 | type ./point.Press Enter |
02:39 | The output is displayed |
02:42 | We see that the num address and ptr value is same. |
02:48 | Whereas memory address of num and ptr are different. |
02:53 | Then the size of pointer is 8 bytes. |
02:57 | Also the value pointed by ptr is 10 which was assigned to num |
03:04 | Now let us see the same program in C++. |
03:08 | Note that our filename is pointers_demo.cpp |
03:14 | Here we have a few changes like the header file as isotream
' |
03:20 | Then we are using the std namespace. |
03:23 | And here we have the cout function in place of printf function.
|
03:28 | Rest all the things are similar. |
03:31 | Let us execute the program |
03:33 | Come back to our terminal. |
03:35 | To compile type: |
03:36 | g++ pointers_demo.cpp -o point1 |
03:48 | Press Enter |
03:51 | Type:./point1. Press Enter |
03:56 | You can see that the output is similar to our C program. |
04:00 | This brings us to the end of this tutorial. |
04:03 | Come back to our slides. |
04:06 | Let us summarize: |
04:07 | In this tutorial we learnt. |
04:09 | About the pointer. |
04:11 | To create a pointer. |
04:12 | And Operation on pointer. |
04:15 | As an assignment write a C and C++ program,
|
04:18 | To declare a variable and pointer. |
04:22 | Store the address of variable in the pointer. |
04:25 | And Print the value of the pointer.
|
04:28 | Watch the video available at http://spoken-tutorial.org/What_is_a_Spoken_Tutorial |
04:31 | It summarizes the Spoken Tutorial project |
04:33 | If you do not have good bandwidth, you can download and watch it
|
04:38 | The Spoken Tutorial Project Team |
04:40 | Conducts workshops using spoken tutorials |
04:43 | Gives certificates for those who pass an online test
|
04:47 | For more details, please write to contact@spoken-tutorial.org
|
04:54 | Spoken Tutorial Project is a part of the Talk to a Teacher project |
04:58 | It is supported by the National Mission on Education through ICT, MHRD, Government of India |
05:06 | More information on this Mission is available at
|
05:11 | This is Ashwini Patil from IIT Bomabay. Siginning off. |
05:15 | Thanks for joining. |