For each argument (in order), the program will print on separate lines
1. integer followed by the argument value if the argument is an integer.
2. error followed by the argument value if the argument is none of the above.
something like this:
./a f c 8 7 c
error a
error c
integer 8
integer 7
error c
I have it print integer, but it doesnt work right, I cant get the integer to print after the word integer, and my error is screwed up. Can anyone point me in the direction of my error? I would really appreciate it.
Thanks
#include <stdio.h>
#include "csc1325.h"
int main (int argc, char * argv[]) {
int i;
i = 0;
while (argv[i] != 0) {
char * s;
s = argv[i];
int k;
k = 0;
if (IsInt(argc, argv, i ) == 1) {
printf("integer\n", i);
}
k = k + 1;
if (argv[i] == 0) {
printf("error\n", argc);
}
k = k + 1;
i = i + 1;
}
return 0;
}


Sign In
Create Account


Back to top









