Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
哪位大哥帮我看一下问题出在哪? runtime error 折磨我啊#include <stdio.h> #include <string.h> #include <malloc.h> void main () { char *back[10], *forward[10], *p, *q; int i = -1, j = -1; q = (char*)malloc (50*sizeof(char)); q = "http://www.acm.org/"; p = (char*)malloc (10*sizeof(char)); scanf("%s",p); while (strcmp(p, "QUIT") != 0) { if(strcmp (p , "VISIT") == 0) { back[++i] = q; q = (char*)malloc (50*sizeof(char)); scanf("%s",q); puts(q); j = -1; } if (strcmp (p, "BACK") == 0) if (i > -1) { forward[++j] = q; q = back[i--]; puts(q); } else printf ("Ignored\n"); if (strcmp(p, "FORWARD") == 0 ) if (j > -1) { back[++i] = q; q = forward[j--]; puts(q); } else printf ("Ignored\n"); memset(p, 0, 10); scanf("%s",p); } } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator