What is the difference between the following two statements in a c++ code.?
1. cout<<*p; //error
2. printf("%d",*p) ; //no error
1. cout<<*p; //error
2. printf("%d",*p) ; //no error
#include<iostream.h>
struct temp
{
int j;
int i;
}a;
void fun(struct temp *p)
{
cout<<*p; //error
p++;
cout<<*p;
}
void main()
{
struct temp *z=&a;
z->j=10;
z->i=1;
fun(z);
}
Comment