Hi everybody,

I'm writing a simple program which is declaring an array of strings and allocating some space using malloc(). Then, Im gonna sort it using qsort(), so i need the size of my array, but it always displays wrong size. However, If I declare the array as I define it and initialize it, the real size is returned. I'd appreciate any opinion or comments that may help.
(FYI, I havent programmed in c for 3-4 years and Im not a malloc expert!!!)

if I use this, that would work fine: (Approach 1)
Code:
    char *S1[] = {"vbhk", "dfgnhd", "dtj6f", "e56u", "qwert", "ertert"};
But this way, its not working: (Approach 2)
Code:
 
    char** S1;
    size_t rows =10;
    size_t cols= 6;
    
    S1 = (char**) malloc(sizeof(char*) * rows);
    for(i=0; i<rows; i++){
         S1[i] = (char*) malloc(sizeof(char) * cols);
     }
I expect that sizeof(S1) returns 10 and sizeof(char*) returns 6. But they return 1 and 4, respectively.

Anything?