Q:

C variable "forgets" what its value is after accepting input

I have written what I thought would be a simple code, but it is misbehaving.
My expected output is:
I'm fine with printing it here 3 
Can be printed as much as I want 3
enter anything: d (I input anything here)
printing it again: 3 
I'm fine with printing it here 3 
...

Which would endlessly loop, but this is what I'm receiving:
I'm fine with printing it here 3 
Can be printed as much as I want 3
enter anything: d
printing it again:
I'm fine with printing it here
...

Essentially, after accepting input for something completely unrelated, it acts as if it's forgotten the value of num. Here's my code:
#include <stdio.h>

int main() {
    char num[1] = "3";
    char entry;
    while(1) {
        printf("I'm fine with printing it here %s \n", num);
        printf("Can be printed as much as I want %s \n", num);
        printf("enter anything: ");
        scanf("%s", &entry);
        printf("printing it again:%s \n", num);
    }
}

Additionally, when I remove the while loop, the output becomes garbled:
I'm fine with printing it here 3??U? 
Can be printed as much as I want 3??U? 
enter anything: d
printing it again: 

I'm new to C, what am I doing wrong here?

A:

The problem is with
 scanf("%s", &entry);

where, you're always overruning the boundary. This invokes undefined behavior.
To elaborate, entry can hold a (only one) char, but %s expects it argument to be a pointer to char array, where it stores the supplied input, plus, the null-terminator.
Now even for a single character input, you'll need an array with two char elements to store that, including the terminating null, so even for the smallest possible input, you're off by one.
That said, you're facing the similar issue with num, while initializing, you don't have the space for the null terminator. You should write
char num[2] = "3"

or, for better, leave it to the compiler
char num[ ] = "3"

to be able to use num as a string.

