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
Can we inherit constructor in c++?
What will strcmp("Astring", "Astring"); return a) A positive value b) A negative value c) Zero
Is c++ the most powerful language?
What is meant by the term name mangling in c++?
Name the operators that cannot be overloaded in C++?
What are put and get pointers?
What's the hardest coding language?
what is C++ exceptional handling?
What is the difference between cin.read() and cin.getline()?
Does improper inheritance have a potential to wreck a project?
What is the outcome of cout< a) 16 b) 17 c) 16.5
How to declaring variables in c++?
Can I learn c++ without learning c?
What is the type of 'this' pointer? When does it get created?
Can the operator == be overloaded for comparing two arrays consisting of characters by using string comparison?