xxxxxxxxxx
#include <stdio.h>
int main(void) {
char a_static[] = { 'q', 'w', 'e', 'r', '\0' };
char b_static[] = { 'a', 's', 'd', 'f', '\0' };
printf("value of a_static: %s\n", a_static);
printf("value of b_static: %s\n", b_static);
return 0;
}
xxxxxxxxxx
char *foo(int count) {
char *ret = malloc(count);
if(!ret)
return NULL;
for(int i = 0; i < count; ++i)
ret[i] = i;
return ret;
}
xxxxxxxxxx
int main() {
char *p = foo(10);
if(p) {
// do stuff with p
free(p);
}
return 0;
}