I'm not well versed in c and I'm having issues with
- iterating through a char* character by character
- correctly comparing the individual character with another character
given a string like "abcda", I want to count the number of "a"s and return the count
    #include <stdio.h>
    #include <unistd.h>
    #include <string.h>
    int main(int argc, char** argv){
        char* string_arg;
        int counter = 0;
        if(argc == 2){
            for(string_arg = argv[1]; *string_arg != '\0'; string_arg++){
                printf(string_arg);
                printf("\n");
                /*given abcda, this prints
                abcda                    a
                bcda                     b
                cda        but i want    c
                da                       d 
                a                        a */
                if(strcmp(string_arg, "a") == 0){ //syntax + logical error
                    counter++;
                }
            }
         printf(counter);
         }
         else{
             printf("error");
         }
         return(0);
    }
I'm also not supposed to use strlen()
How do I compare one character at a time, correctly?
 
     
    