array contains zeros and ones as elements.we need to bring
zeros one side and one other side in single parse.
ex:a[]={0,0,1,0,1,1,0,0}
o/p={0,0,0,0,0,1,1,1}
Answer Posted / vignesh1988i
good morning sir,
in ur above program , u said u took then length as 8 and
then allocated ur memory using DMA... but ur way of
allocation find to be wrong sir.... as you allocated
int *ptr=(int*)malloc(sizeof(8));
the above statement will allocate only 2 bytes for u....
since you have given 8 inside sizeof operator.. this will
tell the compiler allocate 2 bytes of memory .. ur
instruction must be :
int *ptr=(int*)malloc(8*sizeof(int));
so, then it will allocate 8*2 bytes of memory sir.....
so only in my program i have given n*sizeof(int) , where
'n' can be any value that user gives........
thank u
| Is This Answer Correct ? | 5 Yes | 0 No |
Post New Answer View All Answers
What is a class c rental property?
What is meant by recursion?
If you know then define #pragma?
What is function prototype in c with example?
Explain what is a stream?
Why C language is a procedural language?
What is the difference between struct and union in C?
Explain the difference between the local variable and global variable in c?
How can I read in an object file and jump to locations in it?
What is %s and %d in c?
Function calling procedures? and their differences? Why should one go for Call by Reference?
How can you restore a redirected standard stream?
What do you mean by c what are the main characteristics of c language?
What are the back slash character constants or escape sequence charactersavailable in c?
Do pointers store the address of value or the actual value of a variable?