Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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


Please Help Members By Posting Answers For Below Questions

What are the primitive data types in c?

1082


What is equivalent to ++i+++j?

1096


please explain every phase in the "SDLC" in the dotnet.

2622


What is the most efficient way to count the number of bits which are set in an integer?

1067


How do you list a file’s date and time?

1073


#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); }

1160


What is a structure member in c?

1008


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

10206


What is the method to save data in stack data structure type?

1092


Why is c called "mother" language?

1298


I need a sort of an approximate strcmp routine?

1033


What are the storage classes in C?

1161


Is array name a pointer?

1035


Why c is called procedure oriented language?

1055


Which is better malloc or calloc?

1105