I just want to understand pointer to pointer. I write a simple app to calculate the bill of the electric:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define MAXLENGTH 40
#define MAXSTUFF 40
int main()
{
    int n;
    float watt[MAXSTUFF];
    float hours[MAXSTUFF];
    
    printf("How many is your stuff : ");
    scanf("%d", &n);
    getchar();
    
    char stuff[n][MAXLENGTH];
    char * ptrStuff[n];
    char **ptrStuff2 = NULL;
    
    for(int i = 0; i < n; i++) {
        printf("Input your stuff %d: ", i+1);
        fgets(stuff[i], sizeof(stuff[i]), stdin);
                
        printf("Number of watt %d: ", i+1);
        scanf("%f", &watt[i]);
        
        printf("Number of hours %d: ", i+1);
        scanf("%f", &hours[i]);
        
        getchar();
    }
    
    //hitung
    float jum = 0;
    
    for(int i = 0; i < n; i++) {
        //the formula
        jum += watt[i] * 1.4672 * hours[i] * hours[i];
        
    }
    
    //initialize
    
    ptrStuff2 = ptrStuff;
    
    for(int i = 0; i < n; i++)
    {
        //puts(stuff[i]);
        printf("%s \n", ptrStuff2[i]);
    }
    
    printf("Total Rp : %f\n", jum);
    
    return 0;
}
But why the result for printing the stuff got weird? I compiled with gcc and -Wall -Wextra option but no warning found. What I missed? Thanks. I am a newbie.
