Click here to Skip to main content
15,912,400 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
Questionstrcpy Pin
hrishiS3-Feb-09 21:25
hrishiS3-Feb-09 21:25 
AnswerRe: strcpy Pin
Smith#3-Feb-09 21:53
Smith#3-Feb-09 21:53 
GeneralRe: strcpy Pin
hrishiS3-Feb-09 22:37
hrishiS3-Feb-09 22:37 
Questiondisplying of latest data from an XML on the list control. [modified] Pin
brucewayn3-Feb-09 20:54
brucewayn3-Feb-09 20:54 
AnswerRe: displying of latest data from an XML on the list control. Pin
Stuart Dootson3-Feb-09 21:23
professionalStuart Dootson3-Feb-09 21:23 
Questionstuck with a trivia Pin
Smith#3-Feb-09 20:39
Smith#3-Feb-09 20:39 
AnswerRe: stuck with a trivia Pin
cmk3-Feb-09 21:04
cmk3-Feb-09 21:04 
GeneralRe: stuck with a trivia Pin
Smith#3-Feb-09 21:19
Smith#3-Feb-09 21:19 
but why does it work here ?
<br />
	int py[5] = {0,1,2,3,4};<br />
	int* pyp = (int*)py;//py <br />
	printf("%d",pyp[2]);<br />


As it shows, the memory has been laid out for these values,
[START_ADDRESS]4bytes,4bytes,4bytes,4bytes,4bytes.
So when you assign the pointer, it starts to point to the first item. Further when you make a pyp++ or pyp[], it's landing up on the right element. Here too, I'm not passing it any information about the size of the array. It's just the pointer and it's taking it up.
2D arrays, it's not too different from 1D. The next batch of numbers would be following.. err.. err. Okay as I'm typing this I'm getting it Big Grin | :-D ..I'm not giving it any clue where the first row ends.. well..is that what you mean? sounds convincing but why not it work atleast for the first item? I'm just saying **pyp2. Just trying to get the value of the element it's currently pointing to. Why even this doesn't work?

btw, why the complier is not warning me about a meaningless assignment?

Beer | [beer]

AnswerRe: stuck with a trivia Pin
«_Superman_»3-Feb-09 21:10
professional«_Superman_»3-Feb-09 21:10 
GeneralRe: stuck with a trivia Pin
Smith#3-Feb-09 21:25
Smith#3-Feb-09 21:25 
GeneralRe: stuck with a trivia Pin
«_Superman_»3-Feb-09 21:27
professional«_Superman_»3-Feb-09 21:27 
GeneralRe: stuck with a trivia Pin
Smith#3-Feb-09 21:42
Smith#3-Feb-09 21:42 
GeneralRe: stuck with a trivia Pin
«_Superman_»3-Feb-09 21:52
professional«_Superman_»3-Feb-09 21:52 
GeneralRe: stuck with a trivia Pin
Smith#3-Feb-09 21:58
Smith#3-Feb-09 21:58 
GeneralRe: stuck with a trivia Pin
«_Superman_»3-Feb-09 22:03
professional«_Superman_»3-Feb-09 22:03 
GeneralRe: stuck with a trivia Pin
Smith#3-Feb-09 22:20
Smith#3-Feb-09 22:20 
AnswerRe: stuck with a trivia Pin
Stuart Dootson3-Feb-09 21:12
professionalStuart Dootson3-Feb-09 21:12 
GeneralRe: stuck with a trivia [modified] Pin
Smith#3-Feb-09 21:24
Smith#3-Feb-09 21:24 
GeneralRe: stuck with a trivia Pin
Stuart Dootson3-Feb-09 22:01
professionalStuart Dootson3-Feb-09 22:01 
GeneralRe: stuck with a trivia Pin
Smith#3-Feb-09 22:14
Smith#3-Feb-09 22:14 
GeneralRe: stuck with a trivia Pin
Smith#3-Feb-09 22:18
Smith#3-Feb-09 22:18 
AnswerRe: stuck with a trivia Pin
Emilio Garavaglia3-Feb-09 23:13
Emilio Garavaglia3-Feb-09 23:13 
GeneralRe: stuck with a trivia Pin
Smith#4-Feb-09 7:44
Smith#4-Feb-09 7:44 
GeneralRe: stuck with a trivia [modified] Pin
Emilio Garavaglia4-Feb-09 21:32
Emilio Garavaglia4-Feb-09 21:32 
GeneralRe: stuck with a trivia Pin
Smith#7-Feb-09 16:13
Smith#7-Feb-09 16:13 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.