Write code for initializing one dimentional and two
dimentional array in a C Program?

Answer Posted / shruti

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



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

#include { printf("Hello"); } how compile time affects when we add additional header file .

1437


Which is best linux os?

576


What is the use of bitwise operator?

699


What is #include stdlib h?

626


main() { inta=10,b=20; a>=5?b=100:b=200; printf("%d ",b); }

921






What is function what are the types of function?

568


Can we compile a program without main() function?

639


code for find determinent of amatrix

1526


Explain what is meant by 'bit masking'?

652


What is a wrapper function in c?

600


What is meant by preprocessor in c?

544


which type of aspect you want from the student.

1712


What is variable in c example?

600


What are enums in c?

669


what are the 10 different models of writing an addition program in C language?

1447