本文介绍了请检查以下语法并更正它有4个错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

main()
{
    char *name;
    int  length;
    char *cptr = name;
    name = "DELHI";
    printf {"%s\n", name};
    while{*cptr != '\0'}
    {
     printf{"%C is stored at address %u\n", *cptr, cptr};
     cptr++;
     }
     length = cptr - name;
     printf{"\nLength of the string = %d\n", length};
}

推荐答案

#include <stdio.h>

int main()
{
    char *name;
    name = "DELHI";
    int  length;
    char *cptr = name;
    printf ("%s\n", name);
    while(*cptr != '\0')
    {
      printf("%C is stored at address %p\n", *cptr, cptr);
      cptr++;
    }
    length = cptr - name;
    printf("\nLength of the string = %d\n", length);
  return 0;
}





顺便说一句,你真的很喜欢花括号,不是吗?



By the way, you really like curly braces, don't you?



这篇关于请检查以下语法并更正它有4个错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-23 06:18