Write code for initializing one dimentional and two
dimentional array in a C Program?
Answers were Sorted based on User's Feedback
Answer / raam_bangaloreallinter
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 ? | 19 Yes | 1 No |
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 ? | 11 Yes | 3 No |
Answer / kalpana.y
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 ? | 14 Yes | 8 No |
Answer / dinesh kumar
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 ? | 7 Yes | 12 No |
Answer / varsha vilas kalebag
one dimensional array :
a={2}
two dimensional array
b={2,3}
| Is This Answer Correct ? | 5 Yes | 18 No |
A character flag or control mechanism that delineates one data item from another a) variable b) constant c) delimiter d) call by reference
Is it acceptable to declare/define a variable in a c header?
Differentiate call by value and call by reference?
a direct address that identifies a location by means of its displacement from a base address or segment a) absolute address b) relative address c) relative mode d) absolute mode
How do you list files in a directory?
what about "char *(*(*a[])())();"
What is Your Name :)
WAP to accept rollno,course name & marks of a student & display grade if total marks is above 200?
Difference between data structure and data base.
7 Answers CTS, Value Labs, Zoho,
#include <stdio.h> int main ( int argc, char* argv [ ] ) { int value1 = 10; int value2 = 5; printf ( "\n The sum is :%d", value1 | value2 ); } This is the answer asked by some one to add two numbers with out using arithmetic operator?Yes this answer is write it given out put as 15.But how????? what is need of following line? int main ( int argc, char* argv [ ] ) how it work?what is the meaning for this line? please explain me.Advance thanks
What is #include stdio h?
Why cd or dvd are round why not square.