Это работает для меня
/* #include <assert.h> */
#include <stdio.h>
#include <stdlib.h>
struct aPoint {
int somaVertical;
int somaHorizontal;
int valor;
};
int readStuff(struct aPoint *data, int rows, int cols) {
sscanf("42", "%d", &data[3].somaVertical);
sscanf("142", "%d", &data[3].somaHorizontal);
sscanf("-42", "%d", &data[3].valor);
return 0;
}
int main(void) {
struct aPoint *ps;
int colunas, linhas;
colunas = 80;
linhas = 25;
ps = malloc(sizeof *ps * colunas * linhas);
/* assert(ps); */ /* thanks Tim */
if (ps) {
readStuff(ps, linhas, colunas);
printf("%d %d %d\n", ps[3].somaVertical, ps[3].somaHorizontal, ps[3].valor);
free(ps);
} else {
fprintf(stderr, "no memory.\n");
exit(EXIT_FAILURE);
}
return 0;
}