I don't see a problem in the code you are posting; I would guess that your problem is in the code that you aren't posting. Is there some minimal bit you could post that would give this its necessary context?
Here is an example.
- What is atom_name? An array of char? A pointer? An int?
- What is atom_type?
- Where and how are you changing i?
- What does the loop look like?
- Are you checking malloc's return value?
int i, count = 100;
struct sAtom *atom = malloc(count * sizeof(*atom));
if ( atom != NULL )
for ( i = 0; i < count; ++i )
sprintf(atom[i].name, "Name%02d", i);
sprintf(atom[i].type, "Type%02d", i);
printf("i = %2d, name = \"%s\", type = \"%s\"\n", i,
printf("i = %d\n", i);