#include <stdio.h>
#include <string.h>
#include <stdlib.h>

#if 0

int main() {
    int arr[5];
    
    // Initialize the entire array to zeros
    memset(arr, 0, sizeof(arr));
    
    printf("arr[0]: %d\n", arr[0]); // Should print 0
    printf("arr[1]: %d\n", arr[1]); // Should print 0
    printf("arr[2]: %d\n", arr[2]); // Should print 0
    printf("arr[3]: %d\n", arr[3]); // Should print 0
    printf("arr[4]: %d\n", arr[4]); // Should print 0
    
    return 0;
}
#endif

#define max_str_len 100
#define max_char_size 100
char strkey[max_str_len];
int str_key_len;
char *charkey;

int main(){
    FILE *file = fopen("/tmp/sid.txt","r");
    //FILE *f2;

    while(fgets(strkey,max_str_len,file)){//no fgets here
        str_key_len=strlen(strkey);
        charkey = (char *)malloc(100*sizeof(char));
        memset(charkey, 0, 100);
        strncpy(charkey, strkey, str_key_len-1);
        printf("%s\n",charkey);
    }
    free(charkey);
    fclose(file);
}

Embed on website

To embed this program on your website, copy the following code and paste it into your website's HTML: