GeekInterview.com
  I am new, Sign me up!
 
GeekInterview.com  >  Interview Questions  >  Programming  >  C++
Go To First  |  Previous Question  |  Next Question 
 C++  |  Question 145 of 203    Print  
What is the difference between char str, char *str and char* str ?
Explain the meaning of char* or int* ?

  
Total Answers and Comments: 3 Last Update: December 02, 2007     Asked by: poorni1984 
  
 Sponsored Links

 
 Best Rated Answer
Submitted by: berezleon
 
char * str can't store anything --it's just a pointer to a char. If you cout or printf(...) char *str it prints till it finds termination char '';

Above answer was rated as good by the following members:
mucdull
August 30, 2007 10:34:36   #1  
rinas        

RE: What is the difference between char str, char *str...
char str is a char variable which is capable to store one character.
char *str is capable to store a string. its length can be fixed only at run time.
for eg.


char *str;

for(int p 0;s[p];p++)
putchar(str[p]);


in p we will have length of str

 
Is this answer useful? Yes | No
September 22, 2007 05:32:54   #2  
bornToLose        

RE: What is the difference between char str, char *str...
Char* is pointer to char which store address of char variable

IntI is a pointer to int which store the address of int variable.

 
Is this answer useful? Yes | No
December 02, 2007 13:29:22   #3  
berezleon Member Since: December 2007   Contribution: 6    

RE: What is the difference between char str, char *str and char* str ?Explain the meaning of char* or int* ?
char * str can't store anything --it's just a pointer to a char. If you cout or printf(...) char *str it prints till it finds termination char ' ';
 
Is this answer useful? Yes | NoAnswer is useful 1   Answer is not useful 0Overall Rating: +1    


 
Go To Top


 Sponsored Links

 
About Us -  Privacy Policy -  Terms and Conditions -  Contact -  Ask Question -  Propose Category -  Site Updates 

Copyright © 2005 - 2009 GeekInterview.com. All Rights Reserved

Page copy protected against web site content infringement by Copyscape