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   interview questions urls   External Links  Contact Us     Login  |  Sign Up                      
tip       Ask Questions on ANYTHING, that arise in your Daily Life at     FORUM9.COM
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 ?    3 Yes 1 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 ?    1 Yes 3 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 ?    3 Yes 3 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 ?    6 Yes 0 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 ?    3 Yes 1 No
Shruti
 

 
 
 
Other C Interview Questions
 
  Question Asked @ Answers
 
What is structure padding & expalain wid example what is bit wise structure?  1
Write a program to generate prime factors of a given integer?  1
Give the output for the following program. #define STYLE1 char main() { typedef char STYLE2; STYLE1 x; STYLE2 y; clrscr(); x=255; y=255; printf("%d %d\n",x,y); } ADITI1
How to reverse a string using a recursive function, without swapping or using an extra memory? Motorola15
Write a C function to search a number in the given list of numbers. donot use printf and scanf Honeywell6
How would you write qsort?  1
two variables are added answer is stored on not for third variable how it is possible?  2
what is the difference between const volatile int i & volatile const int j; HCL1
6. Which of the Following is not defined in string.h? A)strspn() B)strerror() C)memchr() D)strod() Accenture1
print the following using nested for loop. 5 4 3 2 1 1 2 3 4 3 2 1 1 2 1 2 1 1 2 3 4 3 2 1 1 2 3 4 5  4
in C-programming language without using printf statement can we get output r not ? if yes how and if no also how ?  4
without a terminator how can we print a message in a printf () function. NIIT3
write a program to display the array elements in reverse order in c language  2
difference between my-strcpy and strcpy ? Geometric-Software3
what is the difference between const char *p, char const *p, const char* const p Accenture2
what is memory leak?  3
Will Macros support multiple arguments ? Oracle5
what are the various memory handling mechanisms in C ? HP2
What is the Difference between Class and Struct? Motorola9
implement general tree using link list Wipro1
 
For more C Interview Questions Click Here 
 
 
 
 
 
   
Copyright Policy  |  Terms of Service  |  Help  |  Site Map 1  |  Articles  |  Site Map  |   Site Map  |  Contact Us
   
Copyright © 2007  ALLInterview.com.  All Rights Reserved.

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