CoolInterview.com - World's Largest Collection of Interview Questions
Send Free SMS
 Interview Questions  
 Our Services  


INTERVIEW QUESTIONS LANGUAGES C DETAILS
Question :
What is the difference between a string and an array?



Category C Interview Questions
Rating (4.3) By 8 users
Added on 7/19/2006
Views 2914
Rate it!
Answers:

An array is an array of anything. A string is a specific kind of an array with a well-known convention to
determine its length.
There are two kinds of programming languages: those in which a string is just an array of characters, and those
in which it?s a special type. In C, a string is just an array of characters (type char), with one wrinkle: a C string
always ends with a NUL character. The ?value? of an array is the same as the address of (or a pointer to) the
first element; so, frequently, a C string and a pointer to char are used to mean the same thing.
An array can be any length. If it?s passed to a function, there?s no way the function can tell how long the array
is supposed to be, unless some convention is used. The convention for strings is NUL termination; the last
character is an ASCII NUL (??) character.



"character array" is called as "string" where as array is used to store collection of any simliar data type.



 Posted by: sreelatha    

Contact sreelatha  Contact sreelatha

string is also made up of consecutive location that is array. Without array we can not store any string. We can't define difference between both string and array.



 Posted by: shanmugam    

Contact shanmugam  Contact shanmugam


If you have the better answer, then send it to us. We will display your answer after the approval.
Name :*
Email Id :*
Answer :*
Verification Code Code Image - Please contact webmaster if you have problems seeing this image code Not readable? Load New Code
Process Verification  Enter the above shown code:*
Inform me about updated answers to this question

   
Related Questions
View Answer
Is it better to use a pointer to navigate an array of values,or is it better to use a subscripted array name?


View Answer
Can the sizeof operator be used to tell the size of an array passed to a function?


View Answer
Is using exit() the same as using return?


View Answer
Is it possible to execute code even after the program exits the main() function?


View Answer
What is a static function?


View Answer
How do you print an address?


View Answer
What is the difference between NULL and NUL?


View Answer
What is the stack?


View Answer
What is a null pointer?


View Answer
How can I convert a number to a string?


View Answer

Please Note: We keep on updating better answers to this site. Subscribe to our newsletter to get notified when better answer is posted.

Notify me when better answer is posted!
Email:

View ALL C Interview Questions

User Options
Sponsored Links


Copyright ©2003-2010 CoolInterview.com, All Rights Reserved.
Privacy Policy | Terms and Conditions
Page URL: http://www.coolinterview.com/interview/6073/default.asp?cachecommand=bypass


Download Yahoo Messenger | Placement Papers| FREE SMS | ASP .Net Tutorial | Web Hosting | Free SMS | Dedicated Servers | Joke of the Day

0.73