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 java based off c++?
What are the various storage classes in C++?
What do you mean by function and operator overloading in c++?
Is c++ vector a linked list?
Why do we use double in c++?
Will the following program execute?
Explain queue. How it can be implemented?
What is the difference between method overloading and method overriding in c++?
Does c++ have finally?
What's the best free c++ profiler for windows?
How do you add an element to a set in c++?
Tell me what are static member functions?
Is c++ platform dependent?
List the features of oops in c++?
Write some differences between an external iterator and an internal iterator? Describe the advantage of an external iterator.