QUES:-
Check which operations are not allowed on pointer data types, as compared to integers.
ANS:-
/******************************************************************************/
#include<stdio.h>
#include<conio.h>
int main()
{
int*p,*q;
p--;
p++;
p=p-q;
//p=p+q; NOT ALLOWED
//p=p*q; NOT ALLOWED
//p=p/q; NOT ALLOWED
//p=p%q; NOT ALLOWED
//p=p<<q; NOT ALLOWED
//p=p>>p; NOT ALLOWED
getch();
return 0;
}
/******************************************************************************/
Check which operations are not allowed on pointer data types, as compared to integers.
ANS:-
/******************************************************************************/
#include<stdio.h>
#include<conio.h>
int main()
{
int*p,*q;
p--;
p++;
p=p-q;
//p=p+q; NOT ALLOWED
//p=p*q; NOT ALLOWED
//p=p/q; NOT ALLOWED
//p=p%q; NOT ALLOWED
//p=p<<q; NOT ALLOWED
//p=p>>p; NOT ALLOWED
getch();
return 0;
}
No comments:
Post a Comment