#include <string.h>
void testok(void) reentrant { char buff[20];
buff[0]=1;
strcpy(buff,"hello");
//ok: buff = "hello"
}
void testfail(void) reentrant { char buff[20];
buff[0]=1; buff[2]=2;
//fail: buff = "ello"
void main(void) { testok(); testfail(); }
A failure of this would be far more convincing
#include <stdio.h> #include <string.h> void testok(void) reentrant { char buff[20]; buff[0]=1; strcpy(buff,"hello"); puts(buff); } void testfail(void) reentrant { char buff[20]; buff[0]=1; buff[2]=2; strcpy(buff,"hello"); puts(buff); } void main(void) { testok(); testfail(); }