#include <stdlib.h>
#include <stdio.h>
void my_function(char **); // Change char* to char**
int main(int argc, char *argv[]) {
char *ptr;
ptr = malloc(10);
if(ptr != NULL) printf("FIRST TEST: ptr is not null\n");
else printf("FIRST TEST: ptr is null\n");
my_function(&ptr); //You pass a char**
if(ptr != NULL) printf("SECOND TEST: ptr is not null\n");
else printf("SECOND TEST: ptr is null\n");
}
void my_function(char **a) { //Change char* to char** here
*a = NULL;
}
To embed this project on your website, copy the following code and paste it into your website's HTML: