J
jason_box
I'm trying to parse a data file that has two colums, both columns
should contain numerical values and I would like them to be stored that
way for now into two seperate arrays. I was wondering whats the best
way of doing this?
file:
112 56
344 3
233 9
This simple program just counts the number of characters and line that
I pipe into the program and I was wondering how to take it to the next
step.
should contain numerical values and I would like them to be stored that
way for now into two seperate arrays. I was wondering whats the best
way of doing this?
file:
112 56
344 3
233 9
This simple program just counts the number of characters and line that
I pipe into the program and I was wondering how to take it to the next
step.
Code:
#include <stdio.h>
int main()
{
int c, nc = 0, nl = 0;
while ( (c = getchar()) != EOF )
{
nc++;
if (c == '\n') nl++;
}
printf("Number of characters = %d, number of lines = %d\n", nc,
nl);
return 0;
}