[Solved] functionally modifying typedef string in c, references, pointers,


Making minimal modifications to your code, you might want something like this:

#include <stdio.h>

typedef char * string;

void func2(string *str){
    *str = "blah";
}

void func1(string *str){ 
    func2(str);
}

int main(){
    string str;

    func1(&str);
    puts(str);

    func2(&str);
    puts(str);

    return 0;
}

Compiled and tested okay.

6

solved functionally modifying typedef string in c, references, pointers,