hexa numbers

this is my code
i don't understand,why my result 12cA is?
please explain to me.
thanks a lot
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
// Example1.cpp : Defines the entry point for the console application.
//

#include"stdafx.h"
#include<iostream>
using namespace std;
int _tmain(int argc, _TCHAR* argv[])
{
	char s[]="1234567890";
	unsigned *p=(unsigned *)&s[2];
	*p=0x4163;
	cout<<(char)(*(p+1))<<endl;
	system("pause");
	return 0;
}
///result on the screen:12cA////////i don't understand.although it is correctly//  


You're obviously using Visual Studio. Why don't you step thru the code in the debugger and watch the memory?
can you speak clearly?i haven't understand.
thank "kbw" very much
Are you using Visual Studio?

Run the program in the debugger and step thru the code.

It's not worth the bother of explaining the code as it looks like nonsense. There are a number of system specific things that conspire to produce that result.
thanks "kbw" very much
Topic archived. No new replies allowed.