Updated. I'm using the malloc command successfully now, but I don't understand how to increase the size of my environment variable.
#include <iostream>
#include <stdlib.h>
#include <stdio.h>
using namespace std;
int main(){
char * envVar = static_cast<char*>(malloc(7));
envVar = getenv ("PS1");
cout << "PS1 value is currently: " << *envVar << endl;
cout << "We will now use putenv to change the PS1 variable" << endl;
putenv("PS1=<duck>");
envVar = getenv ("PS1");
cout << "PS1 value is currently: " << *envVar << endl;
free(envVar);
return 0;
}