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 / shil chawla
the program will not RUN becoz #include<iostream.h>
does not support "printf()".
| Is This Answer Correct ? | 1 Yes | 1 No |
Post New Answer View All Answers
Is c++ platform dependent?
What does iomanip mean in c++?
How does class accomplish data hiding in c++?
Can we get the value of ios format flags?
What is a virtual destructor? Explain the use of it?
What is the difference between reference and pointer?
can any one help to find a specific string between html tags
which is changed to a sting..
weather.html looks (for location) is
If dog is a friend of boy, and terrier derives from dog, is terrier a friend of boy? To what does “event-driven” refer? Which is the best c++ software? How const int *ourpointer differs from int const *ourpointer? Can constructor be static in c++? Explain the purpose of the keyword volatile. What is c++ and its uses? Must accepts "Maestro Cards"
Tax for bike should be less than 15
Total number of lanes is more than 10
Must provides monthly pass
Write a method:
boolean isGoodTollBridge(String[] cardsAccepted, String[] tollTax, boolean hasMonthlyPass, int numberOfLanes);
String[] cardsAccepted A String array of names of card types accepted for payment of toll tax, it can be null if the toll does not accept any card
String[] tollTax A String array of toll tax chart (say “Train : 300â€Â,â€ÂBullCart : 10â€Â)
boolean hasMonthlyPass This parameter defines whether there is any monthly pass available or not
int numberOfLanes This parameter defines the number of lanes for each side