If I want to initialize the array like.
int a[5] = {0};
then it gives me all element 0.
but if i give int a[5] = {5};
then 5 0 0 0 0 is ans.
what will I do for all element 5 5 5 5 5 in a single
statement???

Answers were Sorted based on User's Feedback



If I want to initialize the array like. int a[5] = {0}; then it gives me all element 0. but if i ..

Answer / n

int a[5]={5,5,5,5,5};

Is This Answer Correct ?    27 Yes 1 No

If I want to initialize the array like. int a[5] = {0}; then it gives me all element 0. but if i ..

Answer / jahid

int a[5]={5,5,5,5,5}

Is This Answer Correct ?    8 Yes 1 No

If I want to initialize the array like. int a[5] = {0}; then it gives me all element 0. but if i ..

Answer / litan parida

int a[1000];
memset(&a,0,sizeof(a))

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More C Interview Questions

void main() { int a=1; printf("%d %d %d",a,++a,a++); } the output is supposed to be 1 2 2....but it is 3 3 1 this is due to calling conventions of C. if anyone can explain me how it happens?

7 Answers  


I need a sort of an approximate strcmp routine?

0 Answers  


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

0 Answers   Reliance,


Explain pointers in c programming?

0 Answers  


What is c language & why it is used?

0 Answers  






main() { float a=3.2e40; printf("%d",a); }

9 Answers   Satyam,


What's the right way to use errno?

0 Answers  


write an algorithm which can find the largest number among the given list using binary search ............... this was asked in the interview

2 Answers   Satyam, UNIS, Wipro,


How to set file pointer to beginning c?

0 Answers  


largest Of three Number using without if condition?

0 Answers  


write a prgram of swapping with 2 valiables

6 Answers  


write a program of palindrome(madam=madam) using pointer?

5 Answers   L&T,


Categories