what is difference between array and structure?
Answers were Sorted based on User's Feedback
Answer / kirankumar
Array takes data types of same kind where as structure takes
any kind.
Ex:int n[5];/* one d array
int n[10][10];/* two d array
int n[10][10][10];/* multi d array or jagged array
Structure takes following form:
struct class
{
cahr name;
int marks;
float sbuject[3];
}stuent[100];
Is This Answer Correct ? | 1 Yes | 1 No |
Answer / tsering dolma
array is collection of same data.
structure is collection of hetogenous data
Is This Answer Correct ? | 0 Yes | 0 No |
Answer / tsering dolma
1. Array is collection of homogenous data and
structure is collection of hetogenous data
Is This Answer Correct ? | 0 Yes | 0 No |
Answer / shiva
arry is derived data type,
structure is user defined data type
Is This Answer Correct ? | 0 Yes | 0 No |
Answer / adilakshmi
Array elements are homogeneous type.
Structure elements are different data type.
Array is the pointer to the first element.
Structure is not a pointer.
Is This Answer Correct ? | 0 Yes | 0 No |
Answer / chaudhary paresh
- Array elements are homogeneous. Structure elements are of
different data type.
- Array allocates static memory and uses index / subscript
for accessing elements of the array. Structures allocate
dynamic memory and uses (.) operator for accessing the
member of a structure.
- Array is a pointer to the first element of it. Structure
is not a pointer
- Array element access takes less time in comparison with
structures.
Is This Answer Correct ? | 0 Yes | 0 No |
Answer / viji
array is the collection of same data items are declare under
common name
structure is the collection of different data items are
declare under different name which are accessed under common
name.
Is This Answer Correct ? | 0 Yes | 0 No |
Answer / monishasyed
Array is same data type
it can not bit field
it has the base pointer
structure is the different data type
it can bit field
it has the poiter
Is This Answer Correct ? | 0 Yes | 0 No |
Answer / dhivya
when we are declaring an array a variable is enough with
the size.
when we are declaring structure it contain different data
types.
Is This Answer Correct ? | 16 Yes | 18 No |
Answer / kirankumar
Array is used to represent a group of data items that
belongs to the same type or kind.
int a[5];
i.e a[0],a[1],a[2],a[3],a[4].
all a values are integer types.
If we want to represent data items of different types using
a single name is called strucute.
Ex:struct book
{
char title[20];
int pages;
float price;
};
Is This Answer Correct ? | 0 Yes | 3 No |
what is a function prototype?
What is console in c language?
what is the little endian and big endian?
What is wrong with this program statement?
The program will first compute the tax you owe based on your income. User is prompted to enter income. Program will compute the total amount of tax owed based on the following: Income Tax 0 - $45,000 = 0.15 x income $45,001 - $90,000 = 6750 + 0.20 x (income – 45000) $90,001 - $140,000 = 15750 + 0.26 x (income – 90000) $140,001 - $200,000 = 28750 + 0.29 x (income – 140000) Greater than $200,000 = 46150 + 0.33 x (income – 200000) Dollar amounts should be in dollars and cents (float point numbers with two decimals shown). Tax is displayed on the screen.
macros and function are related in what aspect? a)recursion b)varying no of arguments c)hypochecking d)type declaration
12 Answers HCL, Infosys, Microsoft,
Explain that why C is procedural?
What are run-time errors?
what is the c source code for the below output? 1 0 1 1 0 1 0 1 0 1 1 0 1 0 1
To find whether a number is even or odd without using any conditional operator??
12 Answers College School Exams Tests, IBM,
what are the static variables
8 Answers HCL, iFlex, TCS, Wipro,
input may any number except 1,output will always 1.. conditions only one variable should be declare,don't use operators,expressions,array,structure