Difference between revisions of "Advance-C/C2/Union-and-Typedef/Gujarati"

From Script | Spoken-Tutorial
Jump to: navigation, search
Line 35: Line 35:
 
|-
 
|-
 
| 00:49
 
| 00:49
|  '''Typedef '''keyword is used to give symbolic name to an existing '''type''' or '''user-defined datatypes'''.
+
|  '''Typedef ''' કીવર્ડ વર્તમાન  '''type''' અથવા  '''user-defined ''' ડેટાટાઈપસ સાંકેતિક નામ આપવા માં મદદ કરે છે.  
  
 
|-
 
|-
 
| 00:58
 
| 00:58
It is a way to define '''alias''' to the commands.
+
કમાંડને  માટે  '''alias''' (ઉપનામ)  વ્યાખ્યિત કરવાનો એક માર્ગ છે.
  
 
|-
 
|-
 
| 01:03
 
| 01:03
| It helps to provide clarity to the code.
+
| આ કોડની સ્પષ્ટતા ને પૂરી પડવામાં મદદ કરે છે.
  
 
|-
 
|-
 
| 01:07
 
| 01:07
| It makes the code easier to understand and change.  
+
આ કોડને સમઝવું અને બદલવાનું સહેલું કરે છે.
  
 
|-
 
|-
 
| 01:12
 
| 01:12
| Syntax: '''typedef existing_name alias_name'''. Example: '''typedef unsigned int uint;'''
+
| સિન્ટેક્સ : '''typedef existing_name alias_name'''. ઉદાહરણ : '''typedef unsigned int uint;'''
  
 
|-
 
|-
 
| 01:24
 
| 01:24
| Let us go through an example code.
+
|ચાલો ઉદાહરણને કોડ આપીએ.
  
 
|-
 
|-
 
| 01:28
 
| 01:28
| Note that our filename is '''pallindrome.c'''
+
| નોંધ લો કે આપની ફાઈલનું નામ  '''pallindrome.c''' છે.
  
 
|-
 
|-
 
| 01:34
 
| 01:34
| In this program, we will check whether the given number is a '''pallindrome''' or not.
+
| આ પ્રોગ્રામમાં આપણે તપાસીશું કે આપેલ નંબર '''pallindrome''' (પેલેનડ્રોમ)
  
 
|-
 
|-
 
| 01:41
 
| 01:41
| We have given '''alias '''name as '''uint '''to the''' unsigned int datatype '''using''' typedef''' keyword.
+
| કીવર્ડ નો ઉપયોગ કરીને ''' unsigned int datatype ''' ને    '''uint ''' ઉપનામ આપ્યું છે.
  
 
|-
 
|-
 
| 01:52
 
| 01:52
| Here we are using ''' uint '''to '''declare''' the '''variables.'''
+
| અહી આપણે વેરીએબલને ડીકલેર કરવા માટે  ''' uint ''' નો ઉપયોગ કર્યો છે.
  
 
|-
 
|-
 
| 01:59
 
| 01:59
| This is the logic for '''pallindrome'''.
+
| '''pallindrome''' ના માટે લોજીક છે.
  
 
|-
 
|-
 
| 02:03
 
| 02:03
| Now let us execute the program.
+
| હવે પ્રોગ્રામ એક્ઝીક્યુટ કરીએ.
  
 
|-
 
|-
 
| 02:06
 
| 02:06
| Open the '''terminal''' by pressing '''Ctrl+Alt+T''' keys simultaneously on your keyboard.
+
| ટર્મિનલ ખોલવા માટે કીબોર્ડ પર એક સાથે '''Ctrl+Alt+T''' કી  દાબવો.
  
 
|-
 
|-
 
| 02:16
 
| 02:16
| Type ''' gcc space pallindrome dot c  space hyphen o space pallindrome'''. Press '''Enter'''.
+
| ટાઈપ કરો  ''' gcc space pallindrome dot c  space hyphen o space pallindrome'''. '''Enter''' દબાવો.
  
 
|-
 
|-
 
| 02:29
 
| 02:29
| Type:''' dot slash pallindrome'''
+
| ટાઈપ કરો :''' dot slash pallindrome'''
  
 
|-
 
|-
 
|02:34
 
|02:34
| We see: '''Enter any three digit number'''
+
| આપણે જોઈએ છીએ: '''Enter any three digit number'''
  
 
|-
 
|-
 
| 02:38
 
| 02:38
| I will enter ''' 121'''
+
| મેં  ''' 121''' ઉમેરીશ.
  
 
|-
 
|-
 
| 02:42
 
| 02:42
| The output is: '''Given number is a palindrome number'''
+
| આઉટપુટ છે : '''Given number is a palindrome number'''
  
 
|-
 
|-
Line 111: Line 111:
 
|-
 
|-
 
| 02:52
 
| 02:52
| '''Union''' is a collection of different datatypes grouped together.
+
| '''Union''' વિવિધ ડેટાટાઈપસ ને એક સાથે ગ્રુપ કરવા નું  કલેક્શન છે.
  
 
|-
 
|-
 
| 02:57
 
| 02:57
| '''Union '''allocates one common storage space for all its members.
+
| '''Union ''' તેના બધા મેમ્બરસ માટે એક સમાન સ્ટોરેજ સ્પેસ નિર્ધારિત કરે છે.  
  
 
|-
 
|-
 
| 03:03
 
| 03:03
| We can access only one member of union at a time.  
+
| આપણે એક વખત માં યુનિયન ના એક જ  મેમ્બર ને એક્સેસ કરી શકીએ છીએ.
  
 
|-
 
|-
 
| 03:08
 
| 03:08
| '''Syntax1:'''
+
| '''સિન્ટેક્સ 1:'''
'''union union_name''' within curly brackets '''members;''' after curly brackets '''union_variable'''
+
'''union union_name'''છગડીયા કૌંસમાં  '''members;''' છગડીયા કૌંસ પછી  '''union_variable'''
and a '''semi-colon'''.
+
અને  '''semi-colon'''.
  
 
|-
 
|-
 
| 03:21
 
| 03:21
| We also have an alternate syntax.
+
| આપણી પાસે વૈકલ્પિક સિન્ટેક્સ પણ છે .
'''Syntax 2:''' '''union union_name''' within curly brackets '''members;''' after curly brackets '''semi-colon''' '''union union_name union_variable;'''
+
'''સિન્ટેક્સ :''' '''union union_name''' છગડીયા કૌંસમાં '''members;''' છગડીયા કૌંસ પછી  '''semi-colon''' '''union union_name union_variable;'''
  
 
|-
 
|-
 
| 03:39
 
| 03:39
| Let us see an example.
+
| ચાલો એક ઉદાહરણ જોઈએ.
  
 
|-
 
|-
 
| 03:41
 
| 03:41
| I have a code file; let us go through it.
+
| મારી પાસે એક કોડ ફાઈલ છે ચાલો આને જોઈએ.
  
 
|-
 
|-
 
| 03:47
 
| 03:47
| Note that our filename is '''union dot c'''
+
| નોંધ લો કે આપણી ફાઈલનું નામ  '''union dot c''' છે.
  
 
|-
 
|-
 
| 03:52
 
| 03:52
| We have declared '''union''' named '''student.'''
+
| આપણે  '''student.''' નામનું  '''union''' ડીકલેર કર્યું છે.
  
 
|-
 
|-
 
| 03:56
 
| 03:56
| Here we have three variables '''english''', '''maths''' and''' science.'''
+
| અહી આપણી પાસે ત્રણ વેરીએબલસ છે  '''english''', '''maths''' અને ''' science.'''
  
 
|-
 
|-
 
|04:02
 
|04:02
| In '''main function''', we have declared a '''union''' variable as '''stud.'''
+
| મેઈન ફન્કશન માં આપણે '''union''' વેરીએબલને  '''stud.''' ની જેમ ડીકલેર કયું છે.
  
 
|-
 
|-
 
| 04:09
 
| 04:09
| Here we can access the '''union''' members using a '''union''' variable:
+
| અહી આપણે  '''union''' વેરીએબલ નો ઉપયોગ કરીને '''union''' ના મેમ્બર્સને એક્સેસ કરી શકીએ છીએ:
  
 
*'''stud dot english'''
 
*'''stud dot english'''
Line 166: Line 166:
 
|-
 
|-
 
|04:21
 
|04:21
| Then we calculate the total marks and display it.
+
| પછી આપણે કુલ માર્ક્સની ગણતરી કરીશું અને તેને પ્રદશિત કરીશું.
  
 
|-
 
|-
 
| 04:26
 
| 04:26
| Let us execute. On the '''terminal''', type, '''gcc space union dot c space hyphen o space union'''
+
| ચાલો આને એક્ઝીક્યુટ કરીએ  '''terminal''' પર ટાઈપ કરો , '''gcc space union dot c space hyphen o space union'''
Type '''dot slash union'''
+
ટાઈપ કરો  '''dot slash union'''
  
 
|-
 
|-
 
|04:44
 
|04:44
| The output is displayed as: '''Total is 228'''
+
| આઉટપુટ : '''Total is 228''' દેખાડે છે.
  
 
|-
 
|-
 
| 04:50
 
| 04:50
| Let us see the difference between '''structure '''and''' union'''.
+
| ચાલો '''structure '''અને ''' union''' બંને વચ્ચે તફાવત જોઈએ.
  
 
|-
 
|-
 
| 04:55
 
| 04:55
| '''Union''' allocates a common storage space for all its members.
+
| '''Union''' તેના બધા મેમ્બરોમાટે સમાન સ્ટોરેજ સ્પેસ નિર્ધારિત કરે છે.
  
 
|-
 
|-
 
| 05:01
 
| 05:01
| '''Structure''' allocates separate storage space for all its members.
+
| '''Structure'''   તેના બધા મેમ્બરોમાટે અલગ અલગ સ્ટોરેજ સ્પેસ નિર્ધારિત કરે છે.
  
 
|-
 
|-
 
| 05:07
 
| 05:07
| '''Union''' occupies lower memory space.
+
| '''Union''' ઓછી મેમરી સ્પેસને રોકે છે.
  
 
|-
 
|-
 
| 05:11
 
| 05:11
| '''Structure''' occupies higher memory space.
+
| '''Structure''' વધુ મેમરી સ્પેસને રોકે છે.  
  
 
|-
 
|-
 
| 05:14
 
| 05:14
| Example for '''union:'''  
+
| '''union:''' નો ઉદાહરણ છે.
 
'''union student{int marks;<nowiki>char name[6];</nowiki>double average;};'''
 
'''union student{int marks;<nowiki>char name[6];</nowiki>double average;};'''
  
 
|-
 
|-
 
| 05:27
 
| 05:27
| Memory allocation for '''union''' variable will be''' 8 bytes.'''
+
| '''union''' વેરીએબલ ના માટે મેમેરી એલોકેશન''' 8 bytes.'''   થશે.
  
As '''double datatype''' will occupy the maximum memory space.
+
જેમકે  '''double datatype'''   વધુમાં વધુ મેમરી સ્પેસ ને રોકશે.
  
 
|-
 
|-

Revision as of 16:01, 30 November 2015

Time
Narration
00:01 C માં Typedef and Union પરના સ્પોકન ટ્યુટોરીયલમાં તમારું સ્વાગત છે.
00:07 આ ટ્યુટોરીયલ માં, આપણે શીખીશું,
અમુક ઉદાહરણ સાથે
  • typedef keyword
  • union keyword


00:17 આ ટ્યુટોરીયલ માટે, હું ઉપયોગ કરી રહ્યી છું. Ubuntu Operating System version 11.10. gcc compiler version 4.6.1 on Ubuntu
00:29 આ ટ્યુટોરીયલનો અભ્યાસ કરવા માટે, તમે C ના ટ્યુટોરીયલ સાથે પરિચિત હોવા જોઈએ
00:36 જો નથી તો સંબંધિત ટ્યુટોરિયલ્સ માટે અમારી દેખાડેલ વેબસાઇટ જુઓ.
00:43 હું typedef keyword. ના પરિચય સાથે શરૂઆત કરું છું.
00:49 Typedef કીવર્ડ વર્તમાન type અથવા user-defined ડેટાટાઈપસ સાંકેતિક નામ આપવા માં મદદ કરે છે.
00:58 કમાંડને માટે alias (ઉપનામ) વ્યાખ્યિત કરવાનો એક માર્ગ છે.
01:03 આ કોડની સ્પષ્ટતા ને પૂરી પડવામાં મદદ કરે છે.
01:07

આ કોડને સમઝવું અને બદલવાનું સહેલું કરે છે.

01:12 સિન્ટેક્સ : typedef existing_name alias_name. ઉદાહરણ : typedef unsigned int uint;
01:24 ચાલો ઉદાહરણને કોડ આપીએ.
01:28 નોંધ લો કે આપની ફાઈલનું નામ pallindrome.c છે.
01:34 આ પ્રોગ્રામમાં આપણે તપાસીશું કે આપેલ નંબર pallindrome (પેલેનડ્રોમ)
01:41 કીવર્ડ નો ઉપયોગ કરીને unsigned int datatype ને uint ઉપનામ આપ્યું છે.
01:52 અહી આપણે વેરીએબલને ડીકલેર કરવા માટે uint નો ઉપયોગ કર્યો છે.
01:59 pallindrome ના માટે લોજીક છે.
02:03 હવે પ્રોગ્રામ એક્ઝીક્યુટ કરીએ.
02:06 ટર્મિનલ ખોલવા માટે કીબોર્ડ પર એક સાથે Ctrl+Alt+T કી દાબવો.
02:16 ટાઈપ કરો gcc space pallindrome dot c space hyphen o space pallindrome. Enter દબાવો.
02:29 ટાઈપ કરો : dot slash pallindrome
02:34 આપણે જોઈએ છીએ: Enter any three digit number
02:38 મેં 121 ઉમેરીશ.
02:42 આઉટપુટ છે : Given number is a palindrome number
02:47 Now we will learn about union datatype.
02:52 Union વિવિધ ડેટાટાઈપસ ને એક સાથે ગ્રુપ કરવા નું કલેક્શન છે.
02:57 Union તેના બધા મેમ્બરસ માટે એક સમાન સ્ટોરેજ સ્પેસ નિર્ધારિત કરે છે.
03:03 આપણે એક વખત માં યુનિયન ના એક જ મેમ્બર ને એક્સેસ કરી શકીએ છીએ.
03:08 સિન્ટેક્સ 1:

union union_nameછગડીયા કૌંસમાં members; છગડીયા કૌંસ પછી union_variable અને semi-colon.

03:21 આપણી પાસે વૈકલ્પિક સિન્ટેક્સ પણ છે .

સિન્ટેક્સ : union union_name છગડીયા કૌંસમાં members; છગડીયા કૌંસ પછી semi-colon union union_name union_variable;

03:39 ચાલો એક ઉદાહરણ જોઈએ.
03:41 મારી પાસે એક કોડ ફાઈલ છે ચાલો આને જોઈએ.
03:47 નોંધ લો કે આપણી ફાઈલનું નામ union dot c છે.
03:52 આપણે student. નામનું union ડીકલેર કર્યું છે.
03:56 અહી આપણી પાસે ત્રણ વેરીએબલસ છે english, maths અને science.
04:02 મેઈન ફન્કશન માં આપણે union વેરીએબલને stud. ની જેમ ડીકલેર કયું છે.
04:09 અહી આપણે union વેરીએબલ નો ઉપયોગ કરીને union ના મેમ્બર્સને એક્સેસ કરી શકીએ છીએ:
  • stud dot english
  • stud dot maths
  • stud dot science
04:21 પછી આપણે કુલ માર્ક્સની ગણતરી કરીશું અને તેને પ્રદશિત કરીશું.
04:26 ચાલો આને એક્ઝીક્યુટ કરીએ terminal પર ટાઈપ કરો , gcc space union dot c space hyphen o space union

ટાઈપ કરો dot slash union

04:44 આઉટપુટ : Total is 228 દેખાડે છે.
04:50 ચાલો structure અને union બંને વચ્ચે તફાવત જોઈએ.
04:55 Union તેના બધા મેમ્બરોમાટે સમાન સ્ટોરેજ સ્પેસ નિર્ધારિત કરે છે.
05:01 Structure તેના બધા મેમ્બરોમાટે અલગ અલગ સ્ટોરેજ સ્પેસ નિર્ધારિત કરે છે.
05:07 Union ઓછી મેમરી સ્પેસને રોકે છે.
05:11 Structure વધુ મેમરી સ્પેસને રોકે છે.
05:14 union: નો ઉદાહરણ છે.

union student{int marks;char name[6];double average;};

05:27 union વેરીએબલ ના માટે મેમેરી એલોકેશન 8 bytes. થશે.

જેમકે double datatype વધુમાં વધુ મેમરી સ્પેસ ને રોકશે.

05:39 Exampls for structure:

struct student{int mark;char name[6];double average;};

05:48 Memory allocation for structure variable will be: 2bytes+6bytes+8bytes =16bytes.
06:00 This brings us to the end of this tutorial.
06:04 Let us summarize.
06:06 In this tutorial we learnt,
  • typedef
  • union
  • Difference between union and structure.
06:14 As an assignment,
06:17 Write a program to display records of an employee.
06:21 Like name, address, salary.
06:25 Define a union named employee.
06:29 Give an alias name as emp using typedef.
06:35 Watch the video available at the link shown below
06:39 It summarises the Spoken Tutorial project
06:42 If you do not have good bandwidth, you can download and watch it
06:47 The Spoken Tutorial Project Team , Conducts workshops using spoken tutorials
06:53 Gives certificates to those who pass an online test. For more details, please write to contact@spoken-tutorial.org
07:04 Spoken Tutorial Project is a part of the Talk to a Teacher project
07:08 It is supported by the National Mission on Education through ICT, MHRD, Government of India
07:16 More information on this Mission is available at: http://spoken-tutorial.org\NMEICT-Intro
07:22 This is Ashwini Patil from IIT Bombay.

Thank you for joining.

Contributors and Content Editors

Jyotisolanki, PoojaMoolya