new tasks
This commit is contained in:
parent
2a4d27cea0
commit
80737d5a6a
1194 changed files with 15353 additions and 1 deletions
11
Task/Arrays/C/arrays-4.c
Normal file
11
Task/Arrays/C/arrays-4.c
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
int numElements = 10;
|
||||
int *myArray = malloc(sizeof(int) * numElements); /* array of 10 integers */
|
||||
if ( myArray != NULL ) /* check to ensure allocation succeeded. */
|
||||
{
|
||||
/* allocation succeeded */
|
||||
/* at the end, we need to free the allocated memory */
|
||||
free(myArray);
|
||||
}
|
||||
/* calloc() additionally pre-initializes to all zeros */
|
||||
short *myShorts = calloc( numElements, sizeof(short)); /* array of 10 */
|
||||
if (myShorts != NULL)....
|
||||
Loading…
Add table
Add a link
Reference in a new issue