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???

Answer Posted / litan parida

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

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Can we access array using pointer in c language?

638


Describe explain how arrays can be passed to a user defined function

597


When do we get logical errors?

632


Write a program to print factorial of given number without using recursion?

563


What library is sizeof in c?

561






Tell me about low level programming languages.

636


What are the advantages and disadvantages of a heap?

697


Which is better malloc or calloc?

645


What is the difference between union and anonymous union?

831


the real constant in c can be expressed in which of the following forms a) fractional form only b) exponential form only c) ascii form only d) both a and b

1899


Write a Program to accept different goods with the number, price and date of purchase and display them

5432


All technical questions

1502


Explain what does the characters 'r' and 'w' mean when writing programs that will make use of files?

748


What is signed and unsigned?

631


What is enumerated data type in c?

617