Sunday, 4 August 2013

OPERATORS ALLOWED ON POINTERS

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;
}

/******************************************************************************/

No comments:

Post a Comment