'Unexpected ^G generation on printing strings

I was trying to make a program with C and ncurses which just adds the character you add to a final string and prints it. When I run the code, it normally works with a slight flaw; it generates " ^G" automatically when you enter the code. What causes that?

#include <ncurses.h>
#include <string.h>

 int main() {

     char got;
     char had[64];

     initscr();
     cbreak();
     noecho();
         while(true) {
             got = getch();
             strncat(had, &got, 1);
             printw("%s\n",had);
         }
     endwin();

 return 0; }



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source