The line char *s = NULL creates a variable that holds the memory address of a character. Then it sets that memory address to zero (NULL is address zero).
Then the line sscanf(t, "%s",s); tries to write the contents of t to the string at the location s. This will segfault because your process cannot access address zero.
Your instincts were good to avoid uninitialized variables, but you traded this for unallocated pointers!
Fix this by allocating some space on the stack (or heap) for s by declaring:
char s[STRING_LENGTH];
Where STRING_LENGTH is #defined to be however many characters you want to allocate. This allocates a chunk of memory to hold the null-terminated character array and sets s to the address of the first character
NULL.char *s = malloc(16);instead ofchar *s = NULL;. (malloc #include <stdlib.h> thenprintf("%s\n",s);free(s);)sscanf(t, "%ms", &s);when use glibc. (free(s));s(which containsNULL). It cannot change the value ofs. Look up pass by value if you are still confused.