ALLInterview.com :: Home Page KalAajKal.com
 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                      
tip   To Refer this Site to Your Friends   Click Here
Google
 
Categories  >>  Software  >>  Programming Languages  >>  C
 
 


 

 
 C interview questions  C Interview Questions
 C++ interview questions  C++ Interview Questions
 VC++ interview questions  VC++ Interview Questions
 Delphi interview questions  Delphi Interview Questions
 Programming Languages AllOther interview questions  Programming Languages AllOther Interview Questions
Question
Write code for initializing one dimentional and two 
dimentional array in a C Program?
 Question Submitted By :: Guest
I also faced this Question!!     Rank Answer Posted By  
 
  Re: Write code for initializing one dimentional and two dimentional array in a C Program?
Answer
# 1
array:array is a collection of elements
one dimensional array:
code:
       datatype arraysize[];
eg:
       int a[5];
two-dimensional array:
code:
       datatype array[rowsize][columnsize];
eg:
       int a[5][5];
 
Is This Answer Correct ?    9 Yes 4 No
Kalpana.y
 
  Re: Write code for initializing one dimentional and two dimentional array in a C Program?
Answer
# 2
static int [5]={2,3,4,5,6};
for one dimensional array
static int[3][3]={1,2,3,4,5,6};
for two dimensional array it consider as rows and columns
 
Is This Answer Correct ?    3 Yes 9 No
Dinesh Kumar
 
 
 
  Re: Write code for initializing one dimentional and two dimentional array in a C Program?
Answer
# 3
one dimensional array :
a={2}
two dimensional array 
b={2,3}
 
Is This Answer Correct ?    4 Yes 9 No
Varsha Vilas Kalebag
 
  Re: Write code for initializing one dimentional and two dimentional array in a C Program?
Answer
# 4
1-D array:

int a[4]={ 10,20,30,40};

2-D array:  # 2 columns and 2 rows
int a[2][2]= {  
       {100,200},                                           
       {300,400} };


Raam - ramumcato@yahoo.com
 
Is This Answer Correct ?    11 Yes 1 No
Raam_bangaloreallinter
[Inknowtech Pvt Ltd.]
 
  Re: Write code for initializing one dimentional and two dimentional array in a C Program?
Answer
# 5
Ans no. 4 is correct..

incase u have to initialise an array have more number of 
elements as i 100 or 200..

eg..

int a[50];
then u can use following functions:

**YOU CAN INITIALISE IT TO A PARTICULAR VALUE ONLY USING 
THE BELOW CODE..

int a[50];
int i;

for (i = 0 ; i < 50 ; i++)
{
  a[i] = 0;
}

similarly for 2D

for(i = 0 ; i < 50 ; i++)
{
   for(j = 0 ; j < 50 ; j++)
   {
      a[i][j] = 0;
   }
}
 
Is This Answer Correct ?    6 Yes 3 No
Shruti
 

 
 
 
Other C Interview Questions
 
  Question Asked @ Answers
 
Tell about strtok & strstr functions Motorola2
how many argument we can pas in in a function CTS20
#define swap1(a,b) a=a+b;b=a-b;a=a-b; main() { int x=5,y=10; swap1(x,y); printf("%d %d\n",x,y); swap2(x,y); printf("%d %d\n",x,y); } int swap2(int a,int b) { int temp; temp=a; b=a; a=temp; return; } what are the outputs? Ramco4
How do I access command-line arguments? Wipro2
How to reverse a string using a recursive function, with swapping?  4
how does the C compiler interpret the following two statements p=p+x; q=q+y; a.p=p+x; q=q+y b.p=p+xq=q+y c.p=p+xq; q=q+y d.p=p+x/q=q+y TCS3
without using arithmatic operator solve which number is greater??????????  1
write a string copy function routine?  1
write a C code To reverse a linked list Motorola2
How do I initialize a pointer to a function?  2
How would you sort a linked list?  1
Add 2 64 bit numbers on a 32 bit machine NetApp3
Find string palindrome 10marks Honeywell5
Write a Program to print this triangle: * ** * **** * ****** * ******** * ********** use two nested loops. TCS5
what is the defrenece between structure and union  5
What is the purpose of Scanf Print, getchar, putchar, function?  2
write a program to generate 1st n fibonacci prime number  1
What is volatile  2
how to find a 5th bit is set in c program IBM3
What is true about the following C Functions a.Need not return any value b.Should always return an integer c.Should always return a float d.Should always return more than one value. TCS7
 
For more C Interview Questions Click Here 
 
 
 
 
 
   
Copyright Policy  |  Terms of Service  |  Help  |  Site Map 1  |  Articles  |  Site Map  |   Site Map  |  Contact Us interview questions urls   External Links 
   
Copyright © 2007  ALLInterview.com.  All Rights Reserved.

ALLInterview.com   ::  Forum9.com   ::  KalAajKal.com