Hello
I'm trying to copy into 'vble2' some of the chars of 'name1',
and afterwards, set 'vble2' to uppercase:
char *vble2 = NULL;
vble2 = (char*)malloc(strlen(name1)-5);
strncpy(vble2, name1, strlen(name1)-5);
strupr(vble2);
vble2[strlen(name1)-5] = '\0';
printf("\n vble2 = %s", vble2);
free(vble2);
I do not have any problem to compile it, but when printing
'vble2' I get a memory error in the program.
What am I doing wrong?
Thank you very much...