void myFunc(char name[])
{
OutputDebugStringtheName(name);
}
is there any thing bad about putting the ''name'' as ''char name[]''??
Like i won''t cause any problems with memory will i?
thanks,
Anything bad about using char [] in functions?
hi, for this function:
If I''m not mistaken, that''s the same as using a char* as the argument.
I don''t recommend doing this, as it''s very easy to make mistakes (off-by-1 errors, forgetting a ''\0'', null-pointers, etc.). As long as the string is null-terminated, though, you should be okay.
I don''t recommend doing this, as it''s very easy to make mistakes (off-by-1 errors, forgetting a ''\0'', null-pointers, etc.). As long as the string is null-terminated, though, you should be okay.
If you''re programming in C++, you should generally use the standard C++ std::string type. If you''re programming in C, you don''t have much of a choice.
“Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it.” — Brian W. Kernighan (C programming language co-inventor)
“Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it.” — Brian W. Kernighan (C programming language co-inventor)
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement