:: Home Page            
 Advertise your Business Here     
Browse  |   Placement Papers  |   Company  |   Code Snippets  |   Certifications  |   Visa Questions
Post Question  |   Post Answer  |   My Panel  |   Search  |   Articles  |   Topics  |   ERRORS new
   Refer this Site  Refer This Site to Your Friends  Site Map  Bookmark this Site  Set it as your HomePage  Contact Us     Login  |  Sign Up                      
Categories >> Software >> Programming Languages >> C


 C interview questions  C Interview Questions (2262)
 C++ interview questions  C++ Interview Questions (1118)
 VC++ interview questions  VC++ Interview Questions (342)
 Delphi interview questions  Delphi Interview Questions (510)
 Programming Languages AllOther interview questions  Programming Languages AllOther Interview Questions (648)
what is difference between array and structure?
 Question Submitted By :: C
I also faced this Question!!     Answer Posted By  
# 1
array -same data type
structure -diff datatype
Is This Answer Correct ?    514 Yes 45 No
# 2
Array:Static memory allocation.
It uses the subscript to access the array elements.

Structure:Dynamic memory allocation.
It uses the dot(.)operator to access the structure
Is This Answer Correct ?    388 Yes 38 No
# 3
Array -
* Memory (array size) is fixed
* Accessing an element in array takes constant time. E.g. -
5th element in an array can be accessed as array[4] i.e.
searching/accessing an element in array takes comparatively
less time than in structures.
* Adding/deleting an element in the array is comparatively
difficult since the data already present in the array needs
to be moved
Structure -
* Memory (structure size) can be changed dynamically
* Accessing an element in a list takes more time
comparatively since we need to traverse thro the list
* Adding/deleting takes less time than in arrays
Is This Answer Correct ?    175 Yes 18 No
# 4
Array is a base pointer..
** it points to a particular memory location..

Structure is not a pointer..
Is This Answer Correct ?    175 Yes 42 No
# 5
collection is similar data type array
array always start from 0
array size fixed
Is This Answer Correct ?    90 Yes 30 No
# 6
Are you sure that Structure is object oriented, because
structs came from C, and C wasn't an object-oriented
program, and C++ was using it at the beginning where now
they use class for the same function which is better

Array is a collection of a fixed number of components all of
the same type: it is a homogeneous data structure.

structs (records) - we use them to group items of different
types; a collection of a fixed number of components in which
the components are accessed by name. The components as
mention can be of different types. A struct is typically
Is This Answer Correct ?    68 Yes 14 No
# 7
array has indexed data type.
data type of structure is object type.
Is This Answer Correct ?    72 Yes 23 No
Kalyani Joshi
# 8
ARRAY:- An array can't have bit fields.

STRUCTURE:- Structure can contain bit fields.
Is This Answer Correct ?    62 Yes 15 No
# 9
An array behaves like a built-in data type. All we have to
do is to declare an array variable and use it. But in the
case of a structure, first we have to design and declare a
data structure before the variables of that type are
declared and used
Is This Answer Correct ?    32 Yes 7 No
Siddharth Kothari
# 10
Both arrays and structures are classified as structured data
type as provide a mechanism that enables us to access and
manipulate data in relatively easy manner. but they differ
in number of ways:-
1)An array is a collection of related data elements of same
type. Structure can have elements of different types.
2. An array is derived data type whereas a structure is a
programmer defined one.
3) An array behaves like a built in data types only we need
to declare it.but in case of structures , first we have to
design and declare a data structure before the variables of
that type are declared and used.

example:of array:

void main()
int a[5];//only declare an array variable

example of structure:
struct book_bank
char title[5];
char author[3];
int pages;
float price;
};// this format of defining is also known as TEMPLATE
struct book_bank book1, book2;// declaration of variable
Is This Answer Correct ?    32 Yes 7 No

Other C Interview Questions
  Question Asked @ Answers
main() { int x=5; printf("%d %d %d\n",x,x<<2,x>>2); } what is the output? Ramco 9
What is encapsulation?   2
main() { float f1=10.5; double db1=10.5 if(f1==db1) printf("a"); else printf("b") } CSC 2
Difference between for loop and while loop?   1
what is constant pointer?   3
how to find anagram without using string functions using only loops in c programming Mind-Tree 1
what is pointer TCS 1
what are the difference between ANSI C and Let Us c and Turbo C LG-Soft 4
what is the difference between : func (int list[], ...) or func (int *list , ....) - what is the difference if list is an array and if also if list is a pointer   2
who is the father of c Infosys 4
how to find the kth smallest element in the given list of array elemnts. Silicon 8
how can i get output the following... 5 4 3 2 1 4 3 2 1 3 2 1 2 1 1 and 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 plz plz...   3
For more C Interview Questions Click Here 

Copyright Policy  |  Terms of Service  |  Articles  |  Site Map  |  RSS Site Map  |  Contact Us
Copyright 2013  All Rights Reserved.   ::