Categories:
.NET (961)
C (387)
C++ (185)
CSS (84)
DBA (8)
General (31)
HTML (48)
Java (641)
JavaScript (220)
JSP (109)
JUnit (31)
MySQL (297)
Networking (10)
Oracle (562)
Perl (48)
Perl (9)
PHP (259)
PL/SQL (140)
RSS (51)
Software QA (28)
SQL Server (5)
Struts (20)
Unix (2)
Windows (3)
XHTML (199)
XML (59)
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, 1757👍, 0💬
Popular Posts:
How To Use "IF" Statements on Multiple Conditions? - Oracle DBA FAQ - Understanding PL/SQL Language ...
What Information Is Needed to Connect SQL*Plus an Oracle Server? - Oracle DBA FAQ - Introduction to ...
What is difference between ADPATCH and OPATCH ? # ADPATCH is utility to apply ORACLE application Pat...
How to set a HTML document's background color? document.bgcolor property can be set to any appropria...
What's the difference between J2SDK 1.5 and J2SDK 5.0? There is no difference, Sun Microsystems just...