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
Is malloc memset faster than calloc?
Why array is used in c?
Explain the advantages and disadvantages of macros.
Is void a keyword in c?
Do you have any idea how to compare array with pointer in c?
Why is #define used?
What is the purpose of macro in C language?
What is structure padding and packing in c?
hello freinds next week my interview in reliance,nybody has an idea about it intervew questions..so tell
What is sorting in c plus plus?
How do we open a binary file in Read/Write mode in C?
What do you mean by a local block?
Differentiate between a structure and a union.
How can you avoid including a header more than once?
Which of these functions is safer to use : fgets(), gets()? Why?