How to bound check arrays in cpp / c

Bound checking in cpp /c is headache…. char \*strcpy(char \*dest, const char \*src) { char \*save \= dest; while(\*dest++ \= \*src++); return save; } //main func char *src = “hello to c programming language”; char dest[12]; strcpy(dest,src); //calling function Here we have no bound check on dest size or src size. When we pass it to function it is perfectly alright but problem is dest is array which is just 12 bytes long…but src is larger string… [Read More]