M*m 发帖数: 141 | 1 char *a = "12";
int j = (int)a;
j is 134514482, what is going on here? how does c convert "12" to this
number? |
M*m 发帖数: 141 | 2 is 134514482 the address of a?
【在 M*m 的大作中提到】 : char *a = "12"; : int j = (int)a; : j is 134514482, what is going on here? how does c convert "12" to this : number?
|
P********e 发帖数: 2610 | 3 int j = atoi(a);
char *a = "12";
int j = (int)a;
j is 134514482, what is going on here? how does c convert "12" to this
number?
【在 M*m 的大作中提到】 : char *a = "12"; : int j = (int)a; : j is 134514482, what is going on here? how does c convert "12" to this : number?
|
M*m 发帖数: 141 | 4 Looks like j is the address of the string. but here is another problem.
int main(){
char *a = "12";
int t = (int)a;
printf ("%d\n", t);
printf("%c\n", *((char *)t
【在 P********e 的大作中提到】 : int j = atoi(a); : : char *a = "12"; : int j = (int)a; : j is 134514482, what is going on here? how does c convert "12" to this : number?
|
M*m 发帖数: 141 | 5 Oops, just found the problem. never mind, it is the address.
【在 M*m 的大作中提到】 : Looks like j is the address of the string. but here is another problem. : : : int main(){ : : char *a = "12"; : : int t = (int)a; : : printf ("%d\n", t);
|