How to iterate over a string in C?

前端 未结 13 1298
花落未央
花落未央 2020-11-28 06:43

Right now I\'m trying this:

#include 

int main(int argc, char *argv[]) {

    if (argc != 3) {

        printf(\"Usage: %s %s sourcecode inpu         


        
13条回答
  •  野性不改
    2020-11-28 07:02

    You need a pointer to the first char to have an ANSI string.

    printf("%s", source + i);
    

    will do the job

    Plus, of course you should have meant strlen(source), not sizeof(source).

提交回复
热议问题