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 |
we compile c program in 32 processor and 64 bit processor .exe file is created in both the processors. if we want to run .exe file in 64 bit processor which is created in 32 bit processor. is that .exe file is run or not if it is not run why?
What is the value of uninitialized variable in c?
How do you print an address?
Explain how can you tell whether two strings are the same?
1. Duplicate the even numbers. -1 Sample I/O Array1:- 4,2,24,3,22 Updated Array:- 4,4,2,2,24,24,3,22,22 2. Reverse the array in a region - 1 Sample I/O Array1:- 4,2,24,3,22,41,21 Enter Region:- 2,5 Update Array:-4,41,22,3,24,2,21 3. Store first the even digits in an array and then odd digits in same array -2 Sample I/O Array1:- 4,2,24,3,22,41,21 Array 2:- 4,2,2,4,2,2,4,2,3,1,1 4. Store the count of the digits in all numbers in an array and print the count. -2 Sample I/O Array1:- 4,2,9,3,7,41,28 Array 2:- 0,1,1,1,2,0,0,1,1,1 1-1;2-1;3-1;4-2;7-1;8-1;9-1 5. Store all palindrome numbers in to another array -2 Sample I/O Array1:- 4,22,9,313,7,141,28 Array 2:- 4,22,9,313,141 6. Arrange the array in such a way that odd numbers come first and then even numbers -1 Sample I/O Array1:- 4,22,9,313,7,141,28 Update Array1:- 9,313,7,141,4,22,28 7. Store into another array by inserting it in the right place - 2 Sample I/O Array1:- 4,22,9,313,7,141,28 Array2:- 4 /4,22 /4,9,22 /4,9,22 ,313 /4,7,9,22 ,313 /4,7,9,22 ,141,313 / 4,7,9,22,28 ,141,313 8. Merge two sorted arrays in a sorted fashion - 3 Sample I/O Array 1:- 3,6,7,9,11,16 Array 2:- 1,2,5,7,20 Array 3:- 1,2,3,5,6,7,9,11,16,20 9. Upadte the array so that an array element is followed by its revere - 1 Sample I/O Array 1:- 13,63,74,9,11,16 Updated Array 1:- 13,31,63,36,74,47,9,9,11,11,16,16 10.Spread the digits of the array in the same array. -1 Sample I/O Array 1:- 13,63,74,9,11,16 Updated Array 1:-1,3,6,3,74,9,1,1,1,6 11.Shift the boundary of array to have only 2 digit numbers. Sample I/O Array 1:- 139,643,74,9,101,126 Updated Array 1:- 13,96,43,74,91,11,26 12.Print the largest occuring digit in an array of N numbers. Sample I/O Array 1:- 13,63,74,9,11,16 1 occurs most.
Does * p ++ increment p or what it points to?
What are the languages are portable and platform independent?Why they are like that?
#include<stdio.h> void main() { int a [5]; for (i=0; i<=4; i++) printf(“%d” ,a[i]); }
triangle number finding program...
program to find the ASCII value of a number
How #define works?
What are the advantages of using linked list for tree construction?