The efficiency of a program is primarily measured in terms of time and space complexity. It helps assess how a program performs as the input size grows.

1. Time Complexity:

2. Space Complexity:

3. Measuring Time in C:

You can measure the runtime of a program using the clock() function from time.h.

#include <stdio.h>
#include <time.h>

int main() {
    clock_t start, end;
    double cpu_time_used;

    start = clock();  // Start time

    // Your code here

    end = clock();  // End time
    cpu_time_used = ((double) (end - start)) / CLOCKS_PER_SEC;

    printf("Time taken: %f seconds\\\\n", cpu_time_used);
    return 0;
}

4. Optimizing C Code: