Run Code
|
API
|
Code Wall
|
Users
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Blog
pointer example 3
#include <stdio.h> #include <stdlib.h> void main() { float *myarr; int i; /* Allocate an array of 5 floating point values */ myarr = (float *) calloc(5, sizeof(float)); /* myarr is an array of 5 floating point values */ for (i = 0; i < 5; i++) myarr[i] = 2.0 * i; for (i = 0; i < 5; i++) printf("myarr[%d] = %lf\n", i, myarr[i]); printf("------------------------------\n"); /* Increase the size of the array by 5 more floating point values */ myarr = (float *) realloc(myarr,10 * sizeof(float)); for (i = 5; i < 10; i++) myarr[i] = 10.0 * i; for (i = 0; i < 10; i++) printf("myarr[%d] = %lf\n", i, myarr[i]); }
run
|
edit
|
history
|
help
0
Please
log in
to post a comment.
150108_RecursividadFibonacci
CONTADOR DE PALABRAS
Array Incrementing by 1
PRÁCTICA DE QUICKSORT
CS HW2
3468
C assignment due sunday
Assignment 5
A_141205_ContadorPalabras
project menu
Please log in to post a comment.