Question
Write a C program to parse a *.csv file where fields are separated by the ';' character and print out the average of each column
Write a C program to parse a *.csv file where fields are separated by the ';' character and print out the average of each column (which is an integer), separated by the ';' character. You may assume that the number of fields in a *.csv file is no more than 1000
Your executable file must be named avgcsv. It should take as argument the name of a csv file and outputs the average of each column, separated by ';'.
For example, suppose the contents of the example.csv are as follows:
$ cat example.csv 10;25;56 22;10;100
Then, the expected output of the command ./avgcsv example.csv should be:
$ ./avgcsv example.csv 16.0;17.5;78.0
We expect you to write a Makefile to generate the avgcsv executable file from your source code.
I have a few days to complete this assignment, so please take your time when answering this question. Please make sure to attach the main() code as well as the Makefile. Additionally, the program must read from a file. I look forward to reading your answer.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started