Click here to Skip to main content
15,887,311 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionNON MFC / WINAPI Problem related to Process and Files. Pin
lokesh.mavale13-Dec-13 13:07
lokesh.mavale13-Dec-13 13:07 
QuestionExtract RGB Colors Pin
Django_Untaken13-Dec-13 1:31
Django_Untaken13-Dec-13 1:31 
AnswerRe: Extract RGB Colors Pin
Richard MacCutchan13-Dec-13 1:49
mveRichard MacCutchan13-Dec-13 1:49 
AnswerRe: Extract RGB Colors Pin
CPallini13-Dec-13 3:06
mveCPallini13-Dec-13 3:06 
AnswerRe: Extract RGB Colors Pin
Eugen Podsypalnikov13-Dec-13 3:18
Eugen Podsypalnikov13-Dec-13 3:18 
QuestionC pointer and array question [Resolved] Pin
econy12-Dec-13 20:07
econy12-Dec-13 20:07 
AnswerRe: C pointer and array question Pin
econy12-Dec-13 20:19
econy12-Dec-13 20:19 
AnswerRe: C pointer and array question [Resolved] Pin
Richard MacCutchan12-Dec-13 21:19
mveRichard MacCutchan12-Dec-13 21:19 
In both cases your syntax seems to be somewhat confused. For case 1 why not just:
C++
char s1[] = {1,2,3,4,5,6,7};
int t1 = s1[2];

In case 2, you are casting an array to a structure which will in many cases break your code. Structures will often have their elements aligned on word boundaries so what you think is elemnt n of the array is actually something completely different. If you want to use a structure then fill it with your data in the first place. Don't use casts unless you know that the data will be in the locations you think it will.

[edit]
Added [] after s1, as Stefan pointed out.
[/edit]
Veni, vidi, abiit domum


modified 13-Dec-13 5:00am.

AnswerRe: C pointer and array question [Resolved] Pin
Stefan_Lang12-Dec-13 22:42
Stefan_Lang12-Dec-13 22:42 
GeneralRe: C pointer and array question [Resolved] Pin
econy16-Dec-13 9:14
econy16-Dec-13 9:14 
GeneralRe: C pointer and array question [Resolved] Pin
Stefan_Lang16-Dec-13 21:25
Stefan_Lang16-Dec-13 21:25 
AnswerRe: C pointer and array question [Resolved] Pin
Stefan_Lang12-Dec-13 23:14
Stefan_Lang12-Dec-13 23:14 
QuestionReplacement for Inline Assembly Pin
Richard Andrew x6412-Dec-13 18:08
professionalRichard Andrew x6412-Dec-13 18:08 
QuestionRe: Replacement for Inline Assembly Pin
Richard MacCutchan12-Dec-13 21:05
mveRichard MacCutchan12-Dec-13 21:05 
AnswerRe: Replacement for Inline Assembly Pin
Richard Andrew x6413-Dec-13 7:44
professionalRichard Andrew x6413-Dec-13 7:44 
AnswerRe: Replacement for Inline Assembly Pin
Rajesh R Subramanian12-Dec-13 23:31
professionalRajesh R Subramanian12-Dec-13 23:31 
AnswerRe: Replacement for Inline Assembly PinPopular
Eugen Podsypalnikov13-Dec-13 1:14
Eugen Podsypalnikov13-Dec-13 1:14 
GeneralRe: Replacement for Inline Assembly Pin
Richard Andrew x6413-Dec-13 7:25
professionalRichard Andrew x6413-Dec-13 7:25 
GeneralRe: Replacement for Inline Assembly Pin
CPallini13-Dec-13 10:02
mveCPallini13-Dec-13 10:02 
AnswerRe: Replacement for Inline Assembly Pin
Chris Losinger15-Dec-13 4:47
professionalChris Losinger15-Dec-13 4:47 
GeneralRe: Replacement for Inline Assembly Pin
Richard Andrew x6415-Dec-13 5:20
professionalRichard Andrew x6415-Dec-13 5:20 
QuestionC Language Tutorial Pin
tgsb11-Dec-13 22:00
tgsb11-Dec-13 22:00 
AnswerRe: C Language Tutorial Pin
Richard MacCutchan11-Dec-13 22:07
mveRichard MacCutchan11-Dec-13 22:07 
QuestionHow to get the android nowtime screen-picture from PC by adb ?? Pin
chehongyang11-Dec-13 19:41
chehongyang11-Dec-13 19:41 
AnswerRe: How to get the android nowtime screen-picture from PC by adb ?? Pin
Albert Holguin12-Dec-13 4:16
professionalAlbert Holguin12-Dec-13 4:16 

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.