News for hackers. Stuff that matters.
Re:Conflating pointers with arrays: C's biggest mistake? (2009) by v_lisivka on Sunday July 22, 2018 @08:35AM (#17586424)

  #include <stdio.h>
  #include <string.h>
  int main() {
    const char* s1="abc";
    const char* s2="1234";
    char str[strlen (s1) + strlen (s2) + 1];
    strcpy (str, s1);
    strcat (str, s2);
    puts(str);
    return 0;
  }

  $ gcc -std=c99 -Wall -Werror ./tst.c -o tst && ./tst
  abc1234

There are no comments on this comment yet.