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

What is an auto keyword in c?

0 Answers  


Which of the following is not an infinite loop ? a.while(1){ .... } b.for(;;){ ... } c.x=0; do{ /*x unaltered within theloop*/ ... }while(x==0); d.# define TRUE 0 ... while(TRUE){ .... }

7 Answers   TCS,


Why is sizeof () an operator and not a function?

0 Answers  


explain what are actual arguments?

0 Answers  


Explain what is a 'locale'?

0 Answers  


What are reserved words?

0 Answers  


What is the Purpose of 'extern' keyword in a function declaration?

0 Answers  


write a c program to print "Welcome" without using semicolon in the whole program ??

15 Answers   Infosys, TCS,


What is variables in c?

0 Answers  


Given an unsigned integer, find if the number is power of 2?

5 Answers  


WHAT IS MEANT BY LIFE?

2 Answers  


#include <stdio.h> #define sqr(x) (x*x) int main() { int x=2; printf("value of x=%d",sqr(x+1)); } What is the value of x?

16 Answers   Accel Frontline, Opera, Oracle,


Categories