Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
- int main()
- {
- char ** word = malloc(sizeof(char *) * 5); // here is my problem
- int i=0;
- for (i=0;i<10;i++)
- {
- word[i]=malloc(sizeof(char)*100);
- sprintf(word[i],"this_%d",i);
- }
- for (i=0;i<10;i++)
- {
- printf("%s %p\n",word[i],word[i]);
- }
- for (i=0;i<10;i++)
- {
- if (strcmp(word[i],"this_4")==0) printf("yes found\n");
- }
- i=0;
- for (i=0;i<10;i++)
- {
- printf("%s %p %p\n",word[i],word[i],&word[i]);
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement