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:
How can I dynamically allocate arrays?
How can I dynamically allocate arrays?
✍: Guest
The equivalence between arrays and pointers allows a pointer to malloc'ed memory to simulate an array quite effectively. After executing
#include <stdlib.h>
int *dynarray;
dynarray = malloc(10 * sizeof(int));
(and if the call to malloc succeeds), you can reference dynarray[i] (for i from 0 to 9) almost as if dynarray were a conventional, statically-allocated array (int a[10]). The only difference is that sizeof will not give the size of the ``array''
2016-04-23, 1671👍, 0💬
Popular Posts:
How do we host a WCF service in IIS? Note: - The best to know how to host a WCF in IIS is by doing a...
What is difference between custom JSP tags and JavaBeans? Custom JSP tag is a tag you defined. You d...
Where Do You Download JUnit? Where do I download JUnit? I don't think anyone will ask this question ...
How is the MVC design pattern used in Struts framework? In the MVS design pattern, there 3 component...
How To Use SELECT Statement to Count the Number of Rows? - Oracle DBA FAQ - Understanding SQL SELECT...