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
What is istream c++?
What is abstract keyword in c++?
What are the four main data types?
an integer constant must have atleast one a) character b) digit c) decimal point
When you overload member functions, in what ways must they differ?
Why do we use classes in programming?
Why the usage of pointers in C++ is not recommended ?
Explain the differences between list x; & list x();.
Distinguish between a # include and #define.
What is the latest version on c++?
What is #include iostream in c++?
Is the declaration of a class its interface or its implementation?
When should overload new operator on a global basis or a class basis?
Differentiate between the message and method in c++?
Which c++ compiler is best?