Forums - C# Corner

Forum guidelines
Ken H

Ken H

  • 834
  • 598
  • 212.6k

Some confusion of the character constant

Mar 12 2012 7:02 AM
hi all,
   Consider the following problem:
first:

#include<stdio.h>
void main()
{
 char ch='\48';
  printf("%c\n",ch);
}
//Why the above code output is 8?

second:

#include<stdio.h>
void main()
{
 char *s="\ta\018bc";
 for(;*s!='\0';s++) printf("*");
}
//Why the above code output is 6 *?

thank very much.

Answers (1)

File APIs for .NET – 25% off Aspose.Total
Aspose are the market leader of .NET APIs for file business formats – natively work with DOCX, XLSX, PPT, PDF, MSG, MPP, images formats and many more! Use coupon code HOL2016PSB