Sure! We can create a generic stack data structure that can support any data type using void pointers in C. Here's the modified version of the stack implementation:

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

#define MAX_SIZE 100

typedef struct {
    void* arr[MAX_SIZE];
    int top;
} Stack;

void initialize(Stack *stack) {
    stack->top = -1;
}

int isEmpty(Stack *stack) {
    return stack->top == -1;
}

int isFull(Stack *stack) {
    return stack->top == MAX_SIZE - 1;
}

void push(Stack *stack, void* data) {
    if (isFull(stack)) {
        printf("Stack Overflow: Cannot push element, stack is full.\n");
    } else {
        stack->arr[++stack->top] = data;
    }
}

void* pop(Stack *stack) {
    if (isEmpty(stack)) {
        printf("Stack Underflow: Cannot pop element, stack is empty.\n");
        return NULL; // Return NULL indicating failure
    } else {
        return stack->arr[stack->top--];
    }
}

void* peek(Stack *stack) {
    if (isEmpty(stack)) {
        printf("Stack is empty.\n");
        return NULL; // Return NULL indicating failure
    } else {
        return stack->arr[stack->top];
    }
}

// Example usage with int and double types
int main() {
    Stack stack;
    initialize(&stack);

    int num1 = 10;
    double num2 = 3.14;

    push(&stack, &num1);
    push(&stack, &num2);

    int* intPtr = (int*)peek(&stack);
    if (intPtr) {
        printf("Top element (int): %d\n", *intPtr);
    }

    double* doublePtr = (double*)pop(&stack);
    if (doublePtr) {
        printf("Popped element (double): %lf\n", *doublePtr);
    }

    intPtr = (int*)peek(&stack);
    if (intPtr) {
        printf("Top element (int): %d\n", *intPtr);
    }

    return 0;
}
```

In this version, we use `void*` pointers to store data of any type in the stack. This allows us to push and pop elements of various data types. The `main` function demonstrates how to use the stack with both `int` and `double` types. You can use the same stack data structure to store any other data type as needed.

Please note that when retrieving elements from the stack, you need to cast the `void*` pointer to the appropriate data type. This casting is necessary to correctly interpret the data stored in the stack. Also, since the stack is now generic, it's your responsibility to manage memory allocation and deallocation for elements appropriately.
spam fails_task lang_mismatch pii not_appropriate hate_speech sexual_content quality toxicity humor helpfulness creativity violence