12166 views|3 replies

3

Posts

1

Resources
The OP
 

Why are the results different? [Copy link]


x = 10 *pInt = -858993459 //Shouldn’t *pInt be a random number?

1.png (162.84 KB, downloads: 0)

1.png
This post is from Embedded System

Latest reply

printf("*pInt = %d",(int)*pInt);Try it  Details Published on 2018-1-31 14:45

6040

Posts

204

Resources
2
 
A variable without a value is a random number. Why is it random if it is assigned a value?
This post is from Embedded System
 
 

1w

Posts

16

Resources
3
 
It is different because the second pointer refers to the address, which is different.
This post is from Embedded System
 
Personal signaturehttp://shop34182318.taobao.com/
https://shop436095304.taobao.com/?spm=a230r.7195193.1997079397.37.69fe60dfT705yr
 
 

7815

Posts

57

Resources
4
 
printf("*pInt = %d",(int)*pInt);Try it
This post is from Embedded System
 
 
 

Guess Your Favourite
Just looking around
Find a datasheet?

EEWorld Datasheet Technical Support

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号
快速回复 返回顶部 Return list