pointer arithmetic in C for getting a string

后端 未结 4 1622
暗喜
暗喜 2021-01-26 05:59

I want to get the elements of an array of characters, but no success at all, the problem is that I only get the first and last element and nothing more, my code is:



        
4条回答
  •  闹比i
    闹比i (楼主)
    2021-01-26 06:46

    Why don't you iterate from first character to the last one and accessing them as array index

    int i;
    int l=strlen(cad);
    for (i=0;i

提交回复
热议问题