Question: Is it possible to switch Network Link Conditioner profiles from MacOS command line or by using script, and generally is it possible to automate NLC, if so how?

Thank you in advance.

Answer: 
Your code has several problems:

* you modify the pointers in the `words` array instead of iterating via an index.
* you check for upper case letters but access offsets outside of its boundaries with `freq[*words[c]-'a']` in this case.
* there is a typo in the last loop: it should be `freq[i]` instead if `freq[c]`.
* you do not need to allocate the array `temp`.
* you must not use `gets` that was removed from the standard. `gets` cannot check for buffer overflow, any malicious input can have untold consequences.
* you should check for `malloc` failure

Here is a corrected version:

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

#define N         20
#define MAX_SIZE  200

int main(void) {
    char *words[N];
    int n, i, j, c, length;
    char temp[MAX_SIZE];
    int freq[26] = { 0 };

    for (n = 0; n < N; n++) {
        printf("Give a word:");
        if (!fgets(temp, sizeof temp, stdin))
            break;
        temp[strcspn(temp, "\n")] = '\0';  /* strip the \n if present */
        length = strlen(temp);
        words[n] = malloc(length + 1);
        if (words[n] == NULL) {
            printf("cannot allocate memory\n");
            exit(EXIT_FAILURE);
        }
        strcpy(words[n], temp);
        printf("%s\n", words[n]);
    }

    for (i = 0; i < n; i++) {
        for (j = 0; (c = words[i][j]) != '\0'; j++) {
            if (c >= 'a' && c <= 'z')
                freq[c - 'a']++;
            else
            if (c >= 'A' && c <= 'Z')
                freq[c - 'A']++;
        }
    }

    for (i = 0; i < 26; i++) {
        if (freq[i] > 0)
            printf("%c occurs %d times in the entered strings.\n", i + 'a', freq[c]);
    }
    return 0;
}

```
Start by distinguishing between upper and lower case. This may not be the complete solution, but it's a start.

```
    if (*words[c]>='a' && *words[c]<='z'){                       
        freq[*words[c]-'a']++;
        words[c]++;
    }
    else if (*words[c]>='A' &&  *words[c]  <='Z'){                       
        freq[*words[c]-'A']++;
        words[c]++;
    }

```