Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
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
C - printf precision modifiers
menu1.c
cstructCensus
150116_PrimoFactorial
Rudra
22nd HW Switchv0.1
Score
Taco practice
18BCE2182 ASSESS_1 Q1-9
Area & Perimeter of Circle