Linux -Blue forest free software | Return to home page | Site Map | Search WWW | Contact Us |
Your current position : Homepage > Free Software > Technological exchanges >System Management


    

Blue Forest http://www.lslnet.com at 3:18 p.m. on August 18, 2006


Malloc error will occur, give explanation!

Why, why has been allocated in the last second malloc
The addresses on redistribution?
This is far too high! Please explain months to master, thank you!
[code] 1 #include<stdio.h>;
2 #include<stdlib.h>;
3 int
4 main ()
5 {
6 int *number= (int *) malloc (10);
*string= 7 char (char *) malloc (10);
8 char kf[10]= "abcdefghi";
9
10 printf ( "%d, %d\n" &number[0], &number[9]);
11 printf ( "%d, %d\n" &string[0], &string[9]);
12
13 int Rifa
14 for (i=0;i<10;i++)
15 {
16 number[i]=i;
17 string[i]=kf[i];
18 }
19
20 for (i=0;i<10;i++)
21 {
22 printf ( "%d : number[%i]= %d \n" &number[i], i, number[i]);
23 }
24 for (i=0;i<10;i++)
25 {
26 printf ( "%d : string[%i]= %c \n" &string[i], i, string[i]);
27 }
28
29 exit (0);
30 }
31
[/code]

Malloc error will occur, give explanation!

No problem!



 Privacy Policy  Copyright © 1999-2000 LSLNET.COM. All rights reserved. Blue Forest website owners. E-mail : Webmaster@lslnet.com