Thank you big brother for your great info.
I am posting here the code for 280 - Vertex where I used malloc, in Linux I don't find any runtime crash but after submission i got RTL. Would you kindly review and help me to find my fault?
#include<stdio.h>
#include<stdlib.h>
short nonaccessible[101 ...
Search found 4 matches
- Mon Dec 29, 2008 6:56 pm
- Forum: Volume 2 (200-299)
- Topic: 280 - Vertex
- Replies: 95
- Views: 37397
- Sun Dec 28, 2008 10:06 am
- Forum: Volume 2 (200-299)
- Topic: 280 - Vertex
- Replies: 95
- Views: 37397
Re: Runtime error for using malloc - how to do DMA in C
Thanks. Yes DMA is an OS staff, I can remember, but here I used it (erroneously) as a shortcut of dynamic memory allocation, not as the acronym of Direct Memory Access.
Your point is right but you will find the RTL even if you use index range between 0 - (n-1) or allocate memory n+1.
My question ...
Your point is right but you will find the RTL even if you use index range between 0 - (n-1) or allocate memory n+1.
My question ...
- Sat Dec 27, 2008 9:13 pm
- Forum: Volume 2 (200-299)
- Topic: 280 - Vertex
- Replies: 95
- Views: 37397
Runtime error for using malloc - how to do DMA in C
Hi,
I received Runtime error whenever I use malloc() for Dynamic memory allocation in C. The same code is accepted if I use static array. I don't know if I use malloc in wrong way. How can I do Dynamic memory allocation in C that won't yield RTL?
Here is a sample code of my malloc use
#include ...
I received Runtime error whenever I use malloc() for Dynamic memory allocation in C. The same code is accepted if I use static array. I don't know if I use malloc in wrong way. How can I do Dynamic memory allocation in C that won't yield RTL?
Here is a sample code of my malloc use
#include ...
- Mon Apr 04, 2005 4:08 pm
- Forum: Volume 103 (10300-10399)
- Topic: 10347 - Medians
- Replies: 32
- Views: 17987
10347 Medians WA!
I got WA for several times :cry: Can any body fix my error?
#include<math.h>
#include<stdio.h>
main(){
double a,b,c,s;
double area,ara;
while(scanf("%f%f%f",&a,&b,&c)!=EOF){
s=(a+b+c)/2.0;
ara=s*(s-a)*(s-b)*(s-c);
if(a<0||b<0||c<0) area=-1.0;
else if(ara<=0) area=-1.0;
else{
area ...
#include<math.h>
#include<stdio.h>
main(){
double a,b,c,s;
double area,ara;
while(scanf("%f%f%f",&a,&b,&c)!=EOF){
s=(a+b+c)/2.0;
ara=s*(s-a)*(s-b)*(s-c);
if(a<0||b<0||c<0) area=-1.0;
else if(ara<=0) area=-1.0;
else{
area ...