pranava's blog

By pranava, history, 6 years ago, In English

The GNU GCC has a variety of problem with string.h library

The version — 5.1.0 of GNU GCC has a problem with the string.h and especially

in the strcat() function of the library.

include <stdio.h>

include <string.h>

int main() { int a; scanf("%d", &a); int i; for(i=0; i<a; i++) { char a[102]; scanf("%s", &a); int b = strlen(a); if(b <=10) { printf("%s", a); } else { char c[4],d[2],e[2]; d[0]= a[0]; d[1] ='\0'; strrev(a); e[0]= a[0]; e[1] ='\0'; itoa(b, c, 10); //sprintf(c, "%d", b); strcat(d, c); strcat(d, e); printf("%s", d); } } return 0; }

// this code faces problem in v- 5.1.0 // but it works fine with v-6.3.0

  • Vote: I like it
  • -40
  • Vote: I do not like it