New to pointers - allocation problem
I'm trying to use an array of strings as:
I'm trying to store each a_id in the str. But after running the follwoing code I find that only the 1st a_id was assigned in all str indices.I've not assigned str to anything!
I know that its some sort of stale pointer thats creating the problem.How to allocate for str?
Could you please shed some light upon this?
fgets (all_id, 100 , f);
sscanf (all_id,"%*s %s %s",a_id,d_id);
str[i] = a_id;