ALLInterview.com :: 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                      
Google
   
 
Categories >> Software >> Programming Languages >> C
 
 


 

 
 C interview questions  C Interview Questions (2253)
 C++ interview questions  C++ Interview Questions (1111)
 VC++ interview questions  VC++ Interview Questions (342)
 Delphi interview questions  Delphi Interview Questions (510)
 Programming Languages AllOther interview questions  Programming Languages AllOther Interview Questions (646)
Question
what is difference between array and structure?
 Question Submitted By :: C
I also faced this Question!!     Answer Posted By  
 
Answer
# 1
array -same data type
structure -diff datatype
 
Is This Answer Correct ?    507 Yes 45 No
Rajesh
 
Answer
# 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
members.
 
Is This Answer Correct ?    384 Yes 37 No
Rajkumars
 
 
 
Answer
# 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 ?    172 Yes 18 No
Vinay
 
Answer
# 4
Array is a base pointer..
** it points to a particular memory location..

Structure is not a pointer..
 
Is This Answer Correct ?    172 Yes 42 No
Shruti
 
Answer
# 5
collection is similar data type array
array always start from 0
array size fixed
 
Is This Answer Correct ?    89 Yes 30 No
Rajprasadmaity
 
Answer
# 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
heterogeneous.
 
Is This Answer Correct ?    67 Yes 14 No
Ira
 
Answer
# 7
array has indexed data type.
data type of structure is object type.
 
Is This Answer Correct ?    70 Yes 23 No
Kalyani Joshi
 
Answer
# 8
ARRAY:- An array can't have bit fields.

STRUCTURE:- Structure can contain bit fields.
 
Is This Answer Correct ?    61 Yes 14 No
Reema
 
Answer
# 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
 
Answer
# 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:

#include<stdio.h>
#include<conio.h>
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 ?    31 Yes 7 No
Shweta
 

 
 
 
Other C Interview Questions
 
  Question Asked @ Answers
 
Find if a number is power of two or not?   1
what is the difference between postfix and prefix unary increment operators?   3
main() { int i,n=010; int sum=0; for(i=1;i<=n;i++) {s=s+i; } printf("%d",&s); getch(); }   6
how write a addtion of two single dimensional array using of pointer in c language? DRDO 3
what is the difference between procedure oriented and object oriented progaming language   1
f1() { f(3);} f(int t) { switch(t); { case 2: c=3; case 3: c=4; case 4: c=5; case 5: c=6; default: c=0;} value of c? Geometric-Software 5
what is diffrence between string and character array?   1
can we write a program in c for printf and scanf without using header file stdio.h   1
what does " calloc" do? Cadence 7
Write a C program to check a number even or odd, without using any relational, arithmetic operator and any loops.   1
Concat two string with most overlapped substring has to remove "abcd"+ "cdef" = "abcdef   6
to get a line of text and count the number of vowels in it   2
 
For more C Interview Questions Click Here 
 
 
 
 
 


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

ALLInterview.com   ::  KalAajKal.com