0

Why I run the code and I just got a segmentation fault?

#include <stdio.h>

int main(void){
    char *string = "hello,world";
    // printf("0x%p\n",string);
    printf("Command:");
    scanf("%s",string);
    printf("%s",string);
    // printf("0x%p\n",&(""));
    // printf("0x%p\n",string);
    return 0;
}
Tenma
  • 1

0 Answers0