whoops... i typed the example in haste and didn't notice that... In the main program i use the malloc to allocate the memory so I can copy data from a file into different char arrays byte to byte.......
Type: Posts; User: tlpog
whoops... i typed the example in haste and didn't notice that... In the main program i use the malloc to allocate the memory so I can copy data from a file into different char arrays byte to byte.......
Indeed ItC... i think i was mixed up with the notation show at the bottom of this fragment:
char *a[2];
char *b[2];
char **all[2] = {a, b};
a[0]= (char *)malloc(20);
a[1]= (char...
Thank you salem and itC for the comments... I think I have enough info now to correct the problem. If i declare something like *a[3]; without initializing the variable with const data and later...
I screwed some based on your suggestions ItsC...
char *a[3] = {"AEI", "OUY", "JKL"};
printf("OUTPUT 1: %c\n", *a[0]); //Accesses the letter A
printf("OUTPUT 2: %c\n", *(a[0] + 1)); //...
If i understand your comment itCbitC, you are saying *(a + 0) + 1 adds 1 to ASCI of 'h', which of course returns a junk value. Maybe I need a clarification of what this decleration : char *a[3]; ......
thanks for the quick reply salem.. I definately suspected something to do with memory allocation... guess it's time for me to learn something new :)
Long time troll, first time poster... I have some problems understanding arrays containing pointers. Take this fragment for example:
char *a[3];
char d[50] = {'a', 'b', 'c'};
...