Categories:
.NET (357)
C (330)
C++ (183)
CSS (84)
DBA (2)
General (7)
HTML (4)
Java (574)
JavaScript (106)
JSP (66)
Oracle (114)
Perl (46)
Perl (1)
PHP (1)
PL/SQL (1)
RSS (51)
Software QA (13)
SQL Server (1)
Windows (1)
XHTML (173)
Other Resources:
I see code like ...
I see code like
char *p = malloc(strlen(s) + 1);
strcpy(p, s);
Shouldn't that be malloc((strlen(s) + 1) * sizeof(char))?
✍: Guest
It's never necessary to multiply by sizeof(char), since sizeof(char) is, by definition, exactly 1. (On the other hand, multiplying by sizeof(char) doesn't hurt, and in some circumstances may help by introducing a size_t into the expression;
2016-06-21, 2469👍, 0💬
Popular Posts:
How To Select All Columns of All Rows from a Table? - MySQL FAQs - SQL SELECT Query Statements with ...
Enable ASP.NET polling using “web.config” file Now that all our database side is configured in order...
When should the method invokeLater() be used? This method is used to ensure that Swing components ar...
Write down the equivalent pointer expression for referring the same element a[i][j][k][l]? a[i] == *...
Can you explain different software development life cycles -part II? Water Fall Model This is the ol...