S
Shraddha
int *s=(int *)2000;
int *p=(int *)1000;
printf("%d",p-s);
int *p=(int *)1000;
printf("%d",p-s);
int *s=(int *)2000;
int *p=(int *)1000;
printf("%d",p-s);
This question doesn't make any sense. You'll take the time to post thisShraddha said:int *s=(int *)2000;
int *p=(int *)1000;
printf("%d",p-s);
int *s=(int *)2000;
int *p=(int *)1000;
printf("%d",p-s);
Salt_Peter said:What will happen is nowhere near as important as what the intention of
the code is. What are you trying to do?
osmium said:It looks to me like he is trying to learn the rules of some computer
language. And perhaps its interaction with its native habitat.
int *s=(int *)2000;
int *p=(int *)1000;
printf("%d",p-s);
It looks to me like he is trying to learn the rules of some computer
language. And perhaps its interaction with its native habitat.
Shraddha said:int *s=(int *)2000;
int *p=(int *)1000;
printf("%d",p-s);
#include <stdio.h>
int main(void)
{
double x = 1.e35;
int n;
n = (int) x;
printf("%d\n", n);
return 0;
}
You would do well to compile this, run it, see what happens and remeber it.
#include <stdio.h>
int main(void)
{
double x = 1.e35;
int n;
n = (int) x;
printf("%d\n", n);
return 0;
}
The message is clear.
A cast says: "compiler, do this conversion. I am a
smart human and I know what I am doing."
The compiler believes you and does its best to comply.
The results may be nonsense, which is what I get on my
compiler. It prints -250. The compilers I have used say "can
not convert' in the pre-cast error message. It really means:
I *will not*, unless you explicitly tell me to.
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.