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

1)#include <iostream.h>

int main()
{
int *a, *savea, i;

savea = a = (int *) malloc(4 * sizeof(int));

for (i=0; i<4; i++) *a++ = 10 * i;


for (i=0; i<4; i++) {
printf("%d\n", *savea);
savea += sizeof(int);
}
return 0;
}
2)#include <iostream.h>

int main()
{
int *a, *savea, i;

savea = a = (int *) malloc(4 * sizeof(int));

for (i=0; i<4; i++) *a++ = 10 * i;


for (i=0; i<4; i++) {
printf("%d\n", *savea);
savea ++;
}
return 0;
}
The output of this two programs will be different why?

Answer Posted / mahesh

first program prints sum of saved and size of int

second one prints only the contenst of saved

Is This Answer Correct ?    2 Yes 3 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What does the following do: for(;;) ; a) Illegal b) Loops forever c) Ignored by compiler...not illegal

1175


What is increment operator in c++?

1023


Describe about storage allocation and scope of global, extern, static, local and register variables?

1259


What is function overloading c++?

1077


What are stacks? Give an example where they are useful.

1056


Can a constructor be private?

1070


Should I learn c++ c?

1052


To which numbering system can the binary number 1101100100111100 be easily converted to?

1067


Why is c++ called oops?

1173


Write a program to concatenate two strings.

1094


What do you mean by friend class & friend function in c++?

1060


If a function doesn’t return a value, how do you declare the function?

1059


What's the hardest coding language?

1004


What are the types of array in c++?

1163


What is type of 'this' pointer? Explain when it is get created?

1015