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 are the primitive data types in c?
What is equivalent to ++i+++j?
please explain every phase in the "SDLC" in the dotnet.
What is the most efficient way to count the number of bits which are set in an integer?
How do you list a file’s date and time?
#define MAX(x,y) (x) >(y)?(x):(y) main() { inti=10,j=5,k=0; k= MAX(i++,++j); printf("%d..%d..%d",i,j,k); }
What is a structure member in c?
I have written a pro*C program to fetch data from the cursor. where in i have used the concept of BULK FETCH.... each FETCH statement is taking lots of time to fetch specified number of rows at...
What is the method to save data in stack data structure type?
Why is c called "mother" language?
I need a sort of an approximate strcmp routine?
What are the storage classes in C?
Is array name a pointer?
Why c is called procedure oriented language?
Which is better malloc or calloc?