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

Can a local variable be volatile in c?

0 Answers  


Blade logic interview question. 1st round is a written tests with 15 multiple questions from c and c++. All are simple basic question. Like int main () { Int i=65; Return printf(ā€œ%cā€, i); } 2nd and 3rd round is technical interview. The position for which I was interview was core UNIX and c. Yes it is for system programming. The company has product name blade server. For their server they are creating their own command for their purpose. Example cd command. We can implement it in a c program by using the chdir() function. So the question asks related to PID, fork, pipe, shared memory, signal. Write a program in c which will act as cp command.

1 Answers   BladeLogic, Infosys,


what is function pointer?

2 Answers   Wipro,


#include <stdio.h> int main() { if ("X" <"x") printf("X smaller than x "); } my question is whats the mistake in this program? find it and please tell me..

3 Answers  


What are bit fields? What is their use?

2 Answers   Adobe,






how to set Nth bit of variable by using MACRO

3 Answers   HCL,


What is a volatile keyword in c?

0 Answers  


Why doesnt long int work?

0 Answers  


get any number as input except 1 and the output will be 1.without using operators,expressions,array,structure.don't print 1 in printf statement

3 Answers  


How do we make a global variable accessible across files? Explain the extern keyword?

0 Answers  


for(i=0;i=printf("Hello");i++); printf("Hello"); how many times how will be printed?????????

8 Answers  


what is the structure?

4 Answers   TCS,


Categories