#include <stdio.h> #include <stdlib.h> #include <string.h> void getString(char* str) { strcpy(str, "test"); } int main(int argc, char* argv[]) { char s[50]; getString(s); s[0] = 'p'; printf("%s\n", s); return 0; }
If you find our content useful and has helped you in the past, you can help the CodeVault community grow by becoming a CodeVault supporter