![]() |
UNKNOWN! runtime error
Code:
#include<stdio.h>Why there is a runtime error in the above programme.......... help!!!!!! URJENT!!!!!!!! |
Re: UNKNOWN! runtime error
Code:
#include<stdio.h>but it uses actually only those the user enter. so if i enter the word car-->'c' 'a' 'r' '\0' so it uses 4 positions instead of 100 so instead of starting from the end of 100positions you must start from the end of 4positions down to 0 |
Re: UNKNOWN! runtime error
That doesn't explain why there would be a runtime error. It would explain why garbage is displayed and if I modify the program to add
Code:
for (i=0; i<100; i++)Enter to reverse : hello ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ olleh but even without this modification I don't get a runtime error (in Visual Studio 2008 building the program in Debug mode). When it prompted you to enter a string, did you enter more than 100 characters? That might cause a runtime error - this is the infamous "buffer overflow" bug. If not then I can only suggest this is a compiler bug. Maybe the RTL has a problem with %c for non-printable characters. You can test this hypothesis with a simple program: Code:
printf("Starting test\n"); |
| All times are GMT +5.5. The time now is 17:49. |