Follow Our FB Page << CircleMedia.in >> for Daily Laughter. We Post Funny, Viral, Comedy Videos, Memes, Vines...

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

Answers were Sorted based on User's Feedback

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

1-D array:

int a={ 10,20,30,40};

2-D array: # 2 columns and 2 rows
int a= {
{100,200},
{300,400} };

Raam - ramumcato@yahoo.com

 Is This Answer Correct ? 19 Yes 1 No

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

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;
then u can use following functions:

**YOU CAN INITIALISE IT TO A PARTICULAR VALUE ONLY USING
THE BELOW CODE..

int a;
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

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

array:array is a collection of elements
one dimensional array:
code:
datatype arraysize[];
eg:
int a;
two-dimensional array:
code:
datatype array[rowsize][columnsize];
eg:
int a;

 Is This Answer Correct ? 14 Yes 8 No

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

static int ={2,3,4,5,6};
for one dimensional array
static int={1,2,3,4,5,6};
for two dimensional array it consider as rows and columns

 Is This Answer Correct ? 7 Yes 12 No

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

one dimensional array :
a={2}
two dimensional array
b={2,3}

 Is This Answer Correct ? 5 Yes 18 No

More C Interview Questions

what is output? main() { #define SQR(x) x++ * ++x int i = 3; printf(" %d %d ",SQR(i),i * SQR(i)); } a)9 27 b)35 60 c)20 60 d)15 175

Explain what is the best way to comment out a section of code that contains comments?

hello everybody can we change a the adress of a variabl i mean can i put for exemple for a int *p: &p=6 ?????????

How will you print TATA alone from TATA POWER using string copy and concate commands in C?

main() { printf("\n %d %d %d",sizeof('3'),sizeof("3"),sizeof(3)); } wat is the o/p and how?

a function gets called when the function name is followed by a a) semicolon (;) b) period(.) c) ! d) none of the above

whether itis a structured language?

Differentiate between the = symbol and == symbol?

what is data structure.in linear and non linear data structures which one is better?Explain

how will you write a program on linked lists using JAVA programming???????????

What are local variables c?

Explain the use of bit fieild.

Categories
• C (4668)
• C++ (3542)
• VC++ (653)
• Delphi (566)
• Python Related (3238)
• PHP Related (7341)
• Scala (340)
• R Programming (396)
• Kotlin (184)
• Apache Groovy (39)
• Ruby (245)
• Go Programming Language (139)
• Objective-C (429)
• Programming Languages AllOther (736)