SlideShare a Scribd company logo
1 of 7
 String itself act as a pointer
 String name is a pointer to the first character in the
string
char str[] ="Happy";
char *p=str;
printf("%sn",str);
printf("%sn",str);
printf("%sn", p);
for(i = 0; str[i]; i++)
printf("%cn",str[i]);
for(i = 0; str[i]!='0'; i++)
printf("%cn",*(str+i));
char *ptr; ptr=str;
for( i=0;str[i];i++)
printf("%ct",*(ptr+i));
ptr=str;
for( i=0;str[i]!='0';i++)
printf("%ct",*ptr++);
Strings in C - How Strings Work as Pointers

More Related Content

What's hot

Mission vim possible
Mission vim possibleMission vim possible
Mission vim possibleSam Gottfried
 
Lcs & fractional knapsack
Lcs & fractional knapsackLcs & fractional knapsack
Lcs & fractional knapsackSajid Hasan
 
響應式網頁實作坊
響應式網頁實作坊響應式網頁實作坊
響應式網頁實作坊Chih-cheng Wang
 
Programa expresiones regulares
Programa expresiones regularesPrograma expresiones regulares
Programa expresiones regularesAnel Sosa
 
PYTHON. AM CALL Pricing Trees
PYTHON. AM CALL Pricing TreesPYTHON. AM CALL Pricing Trees
PYTHON. AM CALL Pricing TreesTianqi Huang, CFA
 
Monte-carlo sim pricing EU call
Monte-carlo sim pricing EU callMonte-carlo sim pricing EU call
Monte-carlo sim pricing EU callTianqi Huang, CFA
 
AP Calculus Slides October 17, 2007
AP Calculus Slides October 17, 2007AP Calculus Slides October 17, 2007
AP Calculus Slides October 17, 2007Darren Kuropatwa
 
Lviv MD Day 2015 Олексій Демедецький "Using Future for async flow application...
Lviv MD Day 2015 Олексій Демедецький "Using Future for async flow application...Lviv MD Day 2015 Олексій Демедецький "Using Future for async flow application...
Lviv MD Day 2015 Олексій Демедецький "Using Future for async flow application...Lviv Startup Club
 

What's hot (9)

Mission vim possible
Mission vim possibleMission vim possible
Mission vim possible
 
Kwp2 091217
Kwp2 091217Kwp2 091217
Kwp2 091217
 
Lcs & fractional knapsack
Lcs & fractional knapsackLcs & fractional knapsack
Lcs & fractional knapsack
 
響應式網頁實作坊
響應式網頁實作坊響應式網頁實作坊
響應式網頁實作坊
 
Programa expresiones regulares
Programa expresiones regularesPrograma expresiones regulares
Programa expresiones regulares
 
PYTHON. AM CALL Pricing Trees
PYTHON. AM CALL Pricing TreesPYTHON. AM CALL Pricing Trees
PYTHON. AM CALL Pricing Trees
 
Monte-carlo sim pricing EU call
Monte-carlo sim pricing EU callMonte-carlo sim pricing EU call
Monte-carlo sim pricing EU call
 
AP Calculus Slides October 17, 2007
AP Calculus Slides October 17, 2007AP Calculus Slides October 17, 2007
AP Calculus Slides October 17, 2007
 
Lviv MD Day 2015 Олексій Демедецький "Using Future for async flow application...
Lviv MD Day 2015 Олексій Демедецький "Using Future for async flow application...Lviv MD Day 2015 Олексій Демедецький "Using Future for async flow application...
Lviv MD Day 2015 Олексій Демедецький "Using Future for async flow application...
 

More from Gem WeBlog

Analysis of optimization algorithms
Analysis of optimization algorithmsAnalysis of optimization algorithms
Analysis of optimization algorithmsGem WeBlog
 
Particle swarm intelligence
Particle swarm intelligenceParticle swarm intelligence
Particle swarm intelligenceGem WeBlog
 
Nature inspired metaheuristics
Nature inspired metaheuristicsNature inspired metaheuristics
Nature inspired metaheuristicsGem WeBlog
 
Darwin's theory of evolution
Darwin's theory of evolutionDarwin's theory of evolution
Darwin's theory of evolutionGem WeBlog
 
no free-lunch theorem
no free-lunch theoremno free-lunch theorem
no free-lunch theoremGem WeBlog
 
Video and animation
Video and animationVideo and animation
Video and animationGem WeBlog
 
Mpeg video compression
Mpeg video compressionMpeg video compression
Mpeg video compressionGem WeBlog
 
Designing multimedia
Designing multimediaDesigning multimedia
Designing multimediaGem WeBlog
 
Testing and Rolling Out Enterprise Applications
Testing and Rolling Out Enterprise ApplicationsTesting and Rolling Out Enterprise Applications
Testing and Rolling Out Enterprise ApplicationsGem WeBlog
 
Constructing Enterprise Applications
Constructing Enterprise  ApplicationsConstructing Enterprise  Applications
Constructing Enterprise ApplicationsGem WeBlog
 
Architecting and Designing Enterprise Applications
Architecting and Designing Enterprise ApplicationsArchitecting and Designing Enterprise Applications
Architecting and Designing Enterprise ApplicationsGem WeBlog
 
Incepting Enterprise Applications
Incepting Enterprise ApplicationsIncepting Enterprise Applications
Incepting Enterprise ApplicationsGem WeBlog
 
Introduction to BEA
Introduction to BEAIntroduction to BEA
Introduction to BEAGem WeBlog
 
Pointers and Structures
Pointers and StructuresPointers and Structures
Pointers and StructuresGem WeBlog
 
Dynamic memory allocation
Dynamic memory allocationDynamic memory allocation
Dynamic memory allocationGem WeBlog
 
Function pointer
Function pointerFunction pointer
Function pointerGem WeBlog
 
10. NULL pointer
10. NULL pointer10. NULL pointer
10. NULL pointerGem WeBlog
 
13. Pointer and 2D array
13. Pointer  and  2D array13. Pointer  and  2D array
13. Pointer and 2D arrayGem WeBlog
 
7. Pointer Arithmetic
7. Pointer Arithmetic7. Pointer Arithmetic
7. Pointer ArithmeticGem WeBlog
 

More from Gem WeBlog (20)

Analysis of optimization algorithms
Analysis of optimization algorithmsAnalysis of optimization algorithms
Analysis of optimization algorithms
 
Particle swarm intelligence
Particle swarm intelligenceParticle swarm intelligence
Particle swarm intelligence
 
Nature inspired metaheuristics
Nature inspired metaheuristicsNature inspired metaheuristics
Nature inspired metaheuristics
 
Darwin's theory of evolution
Darwin's theory of evolutionDarwin's theory of evolution
Darwin's theory of evolution
 
no free-lunch theorem
no free-lunch theoremno free-lunch theorem
no free-lunch theorem
 
Video and animation
Video and animationVideo and animation
Video and animation
 
Mpeg video compression
Mpeg video compressionMpeg video compression
Mpeg video compression
 
Digital audio
Digital audioDigital audio
Digital audio
 
Designing multimedia
Designing multimediaDesigning multimedia
Designing multimedia
 
Testing and Rolling Out Enterprise Applications
Testing and Rolling Out Enterprise ApplicationsTesting and Rolling Out Enterprise Applications
Testing and Rolling Out Enterprise Applications
 
Constructing Enterprise Applications
Constructing Enterprise  ApplicationsConstructing Enterprise  Applications
Constructing Enterprise Applications
 
Architecting and Designing Enterprise Applications
Architecting and Designing Enterprise ApplicationsArchitecting and Designing Enterprise Applications
Architecting and Designing Enterprise Applications
 
Incepting Enterprise Applications
Incepting Enterprise ApplicationsIncepting Enterprise Applications
Incepting Enterprise Applications
 
Introduction to BEA
Introduction to BEAIntroduction to BEA
Introduction to BEA
 
Pointers and Structures
Pointers and StructuresPointers and Structures
Pointers and Structures
 
Dynamic memory allocation
Dynamic memory allocationDynamic memory allocation
Dynamic memory allocation
 
Function pointer
Function pointerFunction pointer
Function pointer
 
10. NULL pointer
10. NULL pointer10. NULL pointer
10. NULL pointer
 
13. Pointer and 2D array
13. Pointer  and  2D array13. Pointer  and  2D array
13. Pointer and 2D array
 
7. Pointer Arithmetic
7. Pointer Arithmetic7. Pointer Arithmetic
7. Pointer Arithmetic
 

Recently uploaded

Introduction to Microprocesso programming and interfacing.pptx
Introduction to Microprocesso programming and interfacing.pptxIntroduction to Microprocesso programming and interfacing.pptx
Introduction to Microprocesso programming and interfacing.pptxvipinkmenon1
 
Call Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile serviceCall Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile servicerehmti665
 
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝soniya singh
 
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSAPPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSKurinjimalarL3
 
SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )Tsuyoshi Horigome
 
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube ExchangerStudy on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube ExchangerAnamika Sarkar
 
IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024Mark Billinghurst
 
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130Suhani Kapoor
 
ZXCTN 5804 / ZTE PTN / ZTE POTN / ZTE 5804 PTN / ZTE POTN 5804 ( 100/200 GE Z...
ZXCTN 5804 / ZTE PTN / ZTE POTN / ZTE 5804 PTN / ZTE POTN 5804 ( 100/200 GE Z...ZXCTN 5804 / ZTE PTN / ZTE POTN / ZTE 5804 PTN / ZTE POTN 5804 ( 100/200 GE Z...
ZXCTN 5804 / ZTE PTN / ZTE POTN / ZTE 5804 PTN / ZTE POTN 5804 ( 100/200 GE Z...ZTE
 
Past, Present and Future of Generative AI
Past, Present and Future of Generative AIPast, Present and Future of Generative AI
Past, Present and Future of Generative AIabhishek36461
 
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCollege Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCall Girls in Nagpur High Profile
 
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
main PPT.pptx of girls hostel security using rfid
main PPT.pptx of girls hostel security using rfidmain PPT.pptx of girls hostel security using rfid
main PPT.pptx of girls hostel security using rfidNikhilNagaraju
 
Artificial-Intelligence-in-Electronics (K).pptx
Artificial-Intelligence-in-Electronics (K).pptxArtificial-Intelligence-in-Electronics (K).pptx
Artificial-Intelligence-in-Electronics (K).pptxbritheesh05
 
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Dr.Costas Sachpazis
 
Current Transformer Drawing and GTP for MSETCL
Current Transformer Drawing and GTP for MSETCLCurrent Transformer Drawing and GTP for MSETCL
Current Transformer Drawing and GTP for MSETCLDeelipZope
 
Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...VICTOR MAESTRE RAMIREZ
 
power system scada applications and uses
power system scada applications and usespower system scada applications and uses
power system scada applications and usesDevarapalliHaritha
 

Recently uploaded (20)

Introduction to Microprocesso programming and interfacing.pptx
Introduction to Microprocesso programming and interfacing.pptxIntroduction to Microprocesso programming and interfacing.pptx
Introduction to Microprocesso programming and interfacing.pptx
 
Call Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile serviceCall Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile service
 
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
 
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSAPPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
 
SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )
 
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube ExchangerStudy on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
 
IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024
 
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
 
ZXCTN 5804 / ZTE PTN / ZTE POTN / ZTE 5804 PTN / ZTE POTN 5804 ( 100/200 GE Z...
ZXCTN 5804 / ZTE PTN / ZTE POTN / ZTE 5804 PTN / ZTE POTN 5804 ( 100/200 GE Z...ZXCTN 5804 / ZTE PTN / ZTE POTN / ZTE 5804 PTN / ZTE POTN 5804 ( 100/200 GE Z...
ZXCTN 5804 / ZTE PTN / ZTE POTN / ZTE 5804 PTN / ZTE POTN 5804 ( 100/200 GE Z...
 
Past, Present and Future of Generative AI
Past, Present and Future of Generative AIPast, Present and Future of Generative AI
Past, Present and Future of Generative AI
 
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCollege Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
 
young call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Service
young call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Serviceyoung call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Service
young call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Service
 
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
main PPT.pptx of girls hostel security using rfid
main PPT.pptx of girls hostel security using rfidmain PPT.pptx of girls hostel security using rfid
main PPT.pptx of girls hostel security using rfid
 
Artificial-Intelligence-in-Electronics (K).pptx
Artificial-Intelligence-in-Electronics (K).pptxArtificial-Intelligence-in-Electronics (K).pptx
Artificial-Intelligence-in-Electronics (K).pptx
 
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
 
Current Transformer Drawing and GTP for MSETCL
Current Transformer Drawing and GTP for MSETCLCurrent Transformer Drawing and GTP for MSETCL
Current Transformer Drawing and GTP for MSETCL
 
Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...
 
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
 
power system scada applications and uses
power system scada applications and usespower system scada applications and uses
power system scada applications and uses
 

Strings in C - How Strings Work as Pointers

  • 1.
  • 2.  String itself act as a pointer  String name is a pointer to the first character in the string
  • 3.
  • 4. char str[] ="Happy"; char *p=str; printf("%sn",str); printf("%sn",str); printf("%sn", p);
  • 5. for(i = 0; str[i]; i++) printf("%cn",str[i]); for(i = 0; str[i]!='0'; i++) printf("%cn",*(str+i));
  • 6. char *ptr; ptr=str; for( i=0;str[i];i++) printf("%ct",*(ptr+i)); ptr=str; for( i=0;str[i]!='0';i++) printf("%ct",*ptr++);