Okay, quick context. This program needs to read up to 50 characters, display a menu and do functions. First function is searching something given by the user in the 50 character array it made earlier. Edit: Right now everything works as intended, except if you input 50 or more characters, the "menu" print happens twice.
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int search(char arr[], int size1);
int main(){
    int fun, funct, i, size1, quit=0, c;
    char arr[50];
    printf("Please input up to 50 characters.\n");
    fgets(arr, 51, stdin);
    size1=strlen(arr);
    while (quit==0){
        printf("Please choose a function:\n1. Search for 
        character.\n2. Replace character.\n3. Look for 
        palindrome.\n4. Quit.\n");
        scanf("%d", &fun);
        while ( (c = getchar()) != EOF && c != '\n' );
        switch (fun){
            case 1:
                funct=search(arr,size1);
                break;
            case 2:
                break;
            case 3:
                break;
            case 4:
                quit=1;
                printf("Now quitting...");
                break;
        }
    }
}
int search(char arr[], int size1){
    char sear[50];
    int i, j, e, size2=60, foundn=0, pos[50], y=0, b, m;
    while (size2>size1){
        printf("Input up to %d characters to search.\n", size1);
        gets(sear);
        size2=strlen(sear);
        if (size2>size1){
            printf("Input longer than %d characters.\n", size1);
        }
    }
    for (m=0;m<50;m++){
        pos[m]=100;
    }
    for (j=0;j<size1;j++){
        if (arr[j]==sear[0]){
            e=j;
            for (i=1;i<size2;i++){
                e++;
                if (arr[e]==sear[i]){
                    if (i==(size2-1)){
                        foundn++;
                        pos[y]=j;
                        y++;
                    }
                }
            }
        }
    }
    if (foundn>0){
        printf("Searched characters appear %d times in position(s): 
        ",foundn);
        for (b=0;pos[b]!=100;b++){
            printf("%d.\n", pos[b]);
        }
    }
    else {
        printf("Characters do not appear in string.\n");
    }
}
