Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- void test(char **strArray);
- int main()
- {
- char **strArray;
- test(strArray);
- char *other = "why?"; //Removing this line causes segfault between "attempt" and "success"
- }
- void test(char **strArray)
- {
- int i;
- printf("attempt\n");
- *strArray = malloc(10*sizeof(char *));
- printf("success\n");
- for (i=0; i<10; i++)
- strArray[i] = malloc(3*sizeof(char));
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement