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


INTERVIEW QUESTIONS LANGUAGES C DETAILS
Question :
What are the characteristics of arrays in C?
Category C Interview Questions
Rating (1.0) By 2 users
Added on 10/22/2004
Views 3847
Rate it!
Answers:

1) An array holds elements that have the same data type

2) Array elements are stored in subsequent memory locations

3) Two-dimentional array elements are stored row by row in subsequent memory locations.

4) Array name represents the address of the starting element

5) Array size should be mentioned in the declaration. Array size must be a constant expression and not a variable.



6)While declaring the 2D array, the number of coulmns should be specified and its a mandatory. where as for number of rows there is no such rule.

Example:
#include <stdio.h>
int main()
{
int arr[][2]={1,2,3,4,5,6,7,8};
//where as int arr[4][]={1,2,3,4,5,6,7,8}; gives the error.Coz here compiler gets confuse how much space to allocate to column of a row.

int i,j;
for(i=0;i<4;i++)
{
for(j=0;j<2;j++)
printf("%d ",arr[i][j]);
printf(" ");
}
getch();
}

Output:
1 2
3 4
5 6
7 8



 Posted by: Syed Baseer Ahmed    

Contact Syed Baseer Ahmed  Contact Syed Baseer Ahmed


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
When does the compiler not implicitly generate the address of the first element of an array?
View Answer
What is modular programming?
View Answer
What is a function and built-in function?
View Answer
What is an argument ? differentiate between formal arguments and actual arguments?
View Answer
What is the purpose of main( ) function?
View Answer
What are the advantages of the functions?
View Answer
What is a method?
View Answer
What is a pointer value and address?
View Answer
What is a pointer variable?
View Answer
Are pointers integers?
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/974/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.77