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

What are pointers?

619


What is difference between %d and %i in c?

678


Write a program to swap two numbers without using third variable?

804


What is malloc() function?

626


Explain what math functions are available for integers? For floating point?

596






What is clrscr in c?

657


What is static memory allocation?

595


What is extern keyword in c?

622


what is stack , heap ,code segment,and data segment

2208


Explain bit masking in c?

618


Write a program for Overriding.

666


Which node is more powerful and can handle local information processing or graphics processing?

807


hello freinds next week my interview in reliance,nybody has an idea about it intervew questions..so tell

1652


What is structure packing in c?

593


Explain how can I open a file so that other programs can update it at the same time?

579