|
|
|
c++ code error !!
|
|
08-10-2011, 05:31 PM
(This post was last modified: 08-10-2011 05:31 PM by aizirc.)
Post: #1
|
|||
|
|||
|
c++ code error !!
#include <stdio.h>
#include <conio.h> #include <malloc.h> main() { int *base; // A int i; int cnt=0; int sum=0; printf("how many integers you have to store \n"); scanf("%d",&cnt); // B base = (int *)malloc(cnt * sizeof(int)); // C printf("the base of allocation is %16lu \n",base); // D if(!base) // E printf("unable to allocate size \n"); else { for(int j=0;j<cnt;j++) // F *(base+j)=5; } sum = 0; for(int j=0;j<cnt;j++) // G sum = sum + *(base+j); printf("total sum is %d\n",sum); free(base); // H printf("the base of allocation is %16lu \n",base); base = (int *)malloc(cnt * sizeof(int)); printf("the base of allocation is %16lu \n",base); base = (int *)malloc(cnt * sizeof(int)); // I printf("the base of allocation is %16lu \n",base); base = (int *)calloc(10,2); // J printf("the base of allocation is %16lu \n",base); getche(); return 0; } pano po mapagana 2???neded help! |
|||
|
08-31-2011, 08:59 AM
Post: #2
|
|||
|
|||
|
RE: c++ code error !!
aw may mali sa end ng code mo tol
Quote:getche(); it should be like this Code: Only registered members can see this link. |
|||
|
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 1 Guest(s)








