I was wondering if you’ s could help me out with this program that I am unsure how to approach it as im only new to command line arguments. The program should open a file, read a single line of text from the file, count, display number of words in the line of text and print if the line of text is a palindrome or not (palindrome is a string that is spelt the same way forwards as backwards, example = radar). If no file is passed as a CommLineArg, an error will be displayed. Also, im assuming that only type of file passed as an argument is a text file with .txt extension. I have wrote a piece of code attached, unsure of what to do exactly, any help would be great, thanks.
#include <stdio.h>
int main (int argc, char *argv[])
{
int i;
printf("Argc is %d\n", argc);
for(i=0; i<argc; i++)
printf("Argv[%d] contains %s\n", i, argv[i]);
if(argc==1)
printf("NO FILE SPECIFIED...");
return 0;
}