AllExperts > Experts 
Search      

C++

Volunteer
Answers to thousands of questions
 Home · More Questions · Answer Library  · Encyclopedia ·
More C++ Answers
Question Library

Ask a question about C++
Volunteer
Experts of the Month
Expert Login

Awards

About Us
Tell friends
Link to Us
Disclaimer

 
 
 
 
About Joydeep Bhattacharya
Expertise
TSR, Socket and Very Complex Mathematical Problem

Experience

Organizations
Scodz.com [http://www.scodz.com]

Publications
http://www.scodz.com

Education/Credentials
Master of Computer Applications

Awards and Honors
Being a proud owner of a website of programming called http://www.scodz.com

Past/Present Clients
http://www.funforu.com http://www.dhoondho.com http://analysingc.50webs.com

 
   

You are here:  Experts > Computing/Technology > C/C++ > C++ > Char Pointer

Topic: C++



Expert: Joydeep Bhattacharya
Date: 7/5/2008
Subject: Char Pointer

Question
Hello !!

i am initializing the char pointer with 5 names. How will I print it  :

char *p[]={"anand","abhi","John","Ana","Geshu"};

I just want to print all the names in different lines using *p.

Please help.

Thanks


Answer
Hi Priya

You can do it like this

char *p[]={"anand","abhi","John","Ana","Geshu"};
int i

for(i=0;i<5;i++)
printf("%s",*(p + i));

Do lemme know if you get any problem with the above code.

regards
Joydeep Bhattacharya
http://www.scodz.com

Add to this Answer    Ask a Question



  Rate this Answer
   Was this answer helpful?
Not at allDefinitely              
   12345  

     
About Us | Advertise on This Site | User Agreement | Privacy Policy | Help
Copyright  © 2008 About, Inc. About and About.com are registered trademarks of About, Inc. The About logo is a trademark of About, Inc. All rights reserved.