Find a powerset of a set in C The code below is an implementation of purely recursive solution to find a powerset of any given set. The input set is  a string, and the output - array of strings. Both of them are wrapped into a structure for convenience. The underlying algorithm is pretty common one. The recursive function executes exactly 2^n - 1 times.
I've intentionally removed all memory allocation error checking to make the snippet shorter.
#include &lt;stdio.h&gt;
#include &lt;stdlib.h&gt;
#include &lt;string.h&gt;
   
typedef struct set {
    char* data;
    int size;
} Set;

typedef struct pset {
    char **data;
    int size;
} PSet;

Set *initSet(char *str) {
    Set *set;
    set = malloc(sizeof(Set));  

    set-&gt;data = calloc(strlen(str) + 1, 1);      
    strcpy(set-&gt;data, str);
    set-&gt;size = strlen(str);

    return set;
}

PSet *initPSet(const Set* sset) {
    // wrapper for recursive function getPSet
    void getPSet(PSet *pset, const Set *inputStr, int buffer, int index);

    PSet *pset = malloc(sizeof(PSet));
 
    pset-&gt;data = malloc (sizeof(char *) * (1 &lt;&lt; sset-&gt;size));
  
    // empty set is a subset of any set
    pset-&gt;data[pset-&gt;size] = calloc(2, 1);

    strcpy(pset-&gt;data[pset-&gt;size], &quot;&quot;);
    pset-&gt;size = 1;

    // in case the input set is empty return a set with just one element
    if (sset-&gt;size != 0)
        getPSet(pset, sset, 0, 0);

    return pset;
}

void getPSet(PSet *pset, const Set *set, int buffer, int index) {
    //allocating place for a new subset
    pset-&gt;data[pset-&gt;size] = calloc(strlen(pset-&gt;data[buffer]) + 2, sizeof(char));

    strcpy(pset-&gt;data[pset-&gt;size], pset-&gt;data[buffer]);
    pset-&gt;data[pset-&gt;size][strlen(pset-&gt;data[buffer])] = set-&gt;data[index];
    pset-&gt;size++;

    // local variable pos keeps track of a position of a prefix stored in pset for future recurrent calls
    int pos = pset-&gt;size - 1;

    index++;
   
    if (index &gt;= set-&gt;size) return;

    getPSet(pset, set, buffer, index);
    getPSet(pset, set, pos, index);
}

int main () {

    Set *sset = initSet(&quot;abcd&quot;);
    PSet *pset;

    pset = initPSet(sset);

    for (int i = 0; i &lt; pset-&gt;size; ++i) {
        printf(&quot;{%s}\n&quot;, pset-&gt;data[i]);
    }

    return 0;
}
Just a review of a small portion of code:
PSet *pset = malloc(sizeof(PSet));
pset-&gt;data = malloc (sizeof(char *) * (1 &lt;&lt; sset-&gt;size));
pset-&gt;data[pset-&gt;size] = calloc(2, 1);

pset-&gt;size is not yet assigned a value. pset-&gt;data[pset-&gt;size] is a Bug.  @1201ProgramAlarm
sizeof(char *) --&gt; Is that the correct size?  I need to look for the declarations of pset up some lines and then the definition of PSet some 20 lines upstream.
Consider below instead - no need to check if the correct type.  The size is correct by inspection of this line alone.
pset-&gt;data = malloc(sizeof pset-&gt;data[0] * (1 &lt;&lt; sset-&gt;size));

Later code uses int for indexing and buffer size, yet could have used unsigned and incur no additional cost in performance.  To support unsigned, add u:
pset-&gt;data = malloc(sizeof pset-&gt;data[0] * (1u &lt;&lt; sset-&gt;size));


Redundant string length calculation
Compiler may not optimize the 2 strlen() calls into 1.  Recommend to do so by direct code.
//pset-&gt;data[pset-&gt;size] = calloc(strlen(pset-&gt;data[buffer]) + 2, sizeof(char));
//strcpy(pset-&gt;data[pset-&gt;size], pset-&gt;data[buffer]);
//pset-&gt;data[pset-&gt;size][strlen(pset-&gt;data[buffer])] = set-&gt;data[index];

size_t len = strlen(pset-&gt;data[buffer];
pset-&gt;data[pset-&gt;size] = calloc(len + 2, sizeof(char));
strcpy(pset-&gt;data[pset-&gt;size], pset-&gt;data[buffer]);  // or memcpy()
pset-&gt;data[pset-&gt;size][len] = set-&gt;data[index];  // re-use `len`


Use const for unchanged refenced data
It better conveys code's intent, allows for some optimizations and greater functionally usage.
// Set *initSet(char *str) {
Set *initSet(const char *str) {


Missing freeing of memory
For general usage of these routines, de-allocation routines are needed like uninitSet() and uninitPSet().