Click here to Skip to main content
14,428,333 members

C / C++ / MFC

 
AnswerRe: Convert to ASCII ? Pin
Richard MacCutchan1-Aug-15 5:33
communityengineerRichard MacCutchan1-Aug-15 5:33 
GeneralRe: Convert to ASCII ? Pin
Vaclav_1-Aug-15 10:40
MemberVaclav_1-Aug-15 10:40 
GeneralRe: Convert to ASCII ? Pin
Richard MacCutchan1-Aug-15 22:00
communityengineerRichard MacCutchan1-Aug-15 22:00 
GeneralRe: Convert to ASCII ? Pin
CPallini2-Aug-15 7:56
mveCPallini2-Aug-15 7:56 
QuestionEfficient way of converting an 8bit array of grayscale pixel data into 24bpp bitmap for GDI+? Pin
Kiran Satish31-Jul-15 9:39
MemberKiran Satish31-Jul-15 9:39 
QuestionRe: Efficient way of converting an 8bit array of grayscale pixel data into 24bpp bitmap for GDI+? Pin
CPallini31-Jul-15 22:40
mveCPallini31-Jul-15 22:40 
AnswerRe: Efficient way of converting an 8bit array of grayscale pixel data into 24bpp bitmap for GDI+? Pin
Jochen Arndt31-Jul-15 22:51
mveJochen Arndt31-Jul-15 22:51 
GeneralPassing an "array" in C Pin
PIEBALDconsult31-Jul-15 8:41
professionalPIEBALDconsult31-Jul-15 8:41 
Although I use C# most of the time, I try to use C for small exercises -- to keep my C sharp! Unsure | :~

Anyway... I don't recall having to pass arrays back when I was using C full-time (in the 90s), so I don't know which technique is preferred.
As I see it, there are two basic techniques as precedents in C:

0) Passing the length of the array with the array -- e.g. main ( int argc , char *argv[] )
1) Having a "special value" at the end of the array to indicate the end -- e.g. NULL-terminated strings.

So, if I want to pass an array of structs (four ints), which technique is preferred by the C/C++ community?

I'm actually considering door number...

2) Using a linked list instead. It just seems cleaner, though memory usage is actually increased by 25% in this case.

Again, this is just an exercise, but practicing poor technique can be worse than not practicing at all.

So, what say you? If you have to pick door 0 or door 1, which do you prefer?
GeneralRe: Passing an "array" in C Pin
k505431-Jul-15 8:55
Memberk505431-Jul-15 8:55 
GeneralRe: Passing an "array" in C Pin
PIEBALDconsult31-Jul-15 9:34
professionalPIEBALDconsult31-Jul-15 9:34 
SuggestionRe: Passing an "array" in C Pin
camycentsolutions2-Aug-15 20:36
Membercamycentsolutions2-Aug-15 20:36 
GeneralRe: Passing an "array" in C Pin
Chris Losinger31-Jul-15 10:50
professionalChris Losinger31-Jul-15 10:50 
GeneralRe: Passing an "array" in C Pin
PIEBALDconsult31-Jul-15 11:48
professionalPIEBALDconsult31-Jul-15 11:48 
GeneralRe: Passing an "array" in C Pin
PIEBALDconsult31-Jul-15 15:17
professionalPIEBALDconsult31-Jul-15 15:17 
GeneralRe: Passing an "array" in C Pin
PIEBALDconsult1-Aug-15 22:18
professionalPIEBALDconsult1-Aug-15 22:18 
GeneralRe: Passing an "array" in C Pin
Chris Losinger2-Aug-15 4:52
professionalChris Losinger2-Aug-15 4:52 
GeneralRe: Passing an "array" in C Pin
PIEBALDconsult2-Aug-15 7:36
professionalPIEBALDconsult2-Aug-15 7:36 
GeneralRe: Passing an "array" in C Pin
Chris Losinger2-Aug-15 8:06
professionalChris Losinger2-Aug-15 8:06 
GeneralRe: Passing an "array" in C Pin
PIEBALDconsult2-Aug-15 8:17
professionalPIEBALDconsult2-Aug-15 8:17 
GeneralRe: Passing an "array" in C Pin
PIEBALDconsult4-Aug-15 16:06
professionalPIEBALDconsult4-Aug-15 16:06 
GeneralRe: Passing an "array" in C Pin
Chris Losinger5-Aug-15 2:20
professionalChris Losinger5-Aug-15 2:20 
GeneralRe: Passing an "array" in C Pin
k50545-Aug-15 5:22
Memberk50545-Aug-15 5:22 
GeneralRe: Passing an "array" in C Pin
CPallini31-Jul-15 22:32
mveCPallini31-Jul-15 22:32 
GeneralRe: Passing an "array" in C Pin
PIEBALDconsult1-Aug-15 6:00
professionalPIEBALDconsult1-Aug-15 6:00 
GeneralRe: Passing an "array" in C Pin
CPallini1-Aug-15 6:13
mveCPallini1-Aug-15 6: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.