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

how to capitalise first letter of each word in a given string?

1432


write a c program to print the next of a particular no without using the arithmetic operator or looping statements?

3184


a way in which a pointer stores the address of a pointer which stores the value of the target value a) reference b) allocation c) multiple indirection d) none

631


What is c language used for?

559


Write a program to check palindrome number in c programming?

597






What is d'n in c?

631


What are reserved words?

654


What does the c in ctime mean?

566


the constant value in the case label is followed by a a) semicolon b) colon c) braces d) none of the above

719


What is variables in c?

604


What is the significance of an algorithm to C programming?

596


i want to switch my career from quailty assurance engineering to development kindly guide me from which programming language its better for me to start plz refer some courses or certifications too i have an experience of 1.5 yrs in QA field.Kindly guide me

1480


Why static is used in c?

620


What do you mean by a sequential access file?

625


Why is C language being considered a middle level language?

653