Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Course: Programming technologies (ANSI C)
- // Lab 6. Pointers and Dynamic memory.
- // Student: Barabanova E.A. Group: 1513
- // Teacher: Alexeev P.S.
- // Created 28.12.2009 Modified: 28.12.2009
- // Description: Program entry point.
- #include <stdio.h>
- #include <malloc.h>
- void main()
- {
- int a;
- float mas[4];
- float *pm;
- float *pd;
- pm = &mas[0];
- pm[0]='56.4';
- pm[1]='36.5';
- pm[2]='7.7';
- pm[3]='44.3';
- for (a=0; a<4; a+=1)
- {
- printf("%f", pm[a]);
- };
- printf("\n");
- pd=(float*)calloc(4,sizeof(float));
- pd[0]='56.4';
- pd[1]='36.5';
- pd[2]='7.7';
- pd[3]='44.3';
- for (a=0; a<4; a+=1)
- {
- printf("%f", pd[a]);
- };
- printf("\n");
- free(pd);
- }
Add Comment
Please, Sign In to add comment