Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3695788
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T04:39:37+00:00 2026-05-19T04:39:37+00:00

int main() { char *arr=\\0\1\8234\0; int i=0; while(arr[i]) { switch(arr[i]) { case ‘0’: printf(is

  • 0
int main()
   {       char *arr="\\0\1\8234\0"; int i=0;
           while(arr[i])
           {        switch(arr[i])
                    {
                            case '0': printf("is no"); break;
                            case '00': printf("is debugging\n"); break;
                            case 0: printf("It is Avishkar\n"); break;
                            case '\\': printf("This "); break;
                            case '\1': printf("t s"); break;
                            case '8': printf("o s"); break;
                            case '2': printf("imp"); break;
                            case '3': printf("le as"); break;
                            case 2: case 3: case 4:
                            case 8: printf("This "); break;
                            default: printf(" it seems\n"); break;}
                    i++; } }

please explain the o/p ?
i am not able to get it..

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-19T04:39:37+00:00Added an answer on May 19, 2026 at 4:39 am

    Breaking down the string initialization we have:

    \\ == literal \ character
    \1 == octal representation of integer "1"
    \8 == technically invalid standard C, microsoft compilers will treat an
    unsupported (i.e. non-octal, non-escape, non-hex-specifier) character after
    a slash as if the slash were not present, so this is ascii '8'
    2 == ascii '2'
    3 == ascii '3'
    4 == ascii '4'
    \0 == literal zero
    
    arr[ 0 ] = '\\';   // literal backslash
    arr[ 1 ] = '0';    // ascii '0'
    arr[ 2 ] = 1;      // integer 1
    arr[ 3 ] = '8';      // using microsoft (non-portable) syntax
    arr[ 4 ] = '2';     // ascii '2'
    arr[ 5 ] = '3';     // ascii '3'
    arr[ 6 ] = '4';     // ascii '4'
    arr[ 7 ] = 0;       // integer 0
    

    The loop prints for each successive value of i:

    i == 0: "This "
    i == 1: "is no"
    i == 2: "t s"
    i == 3: "o s"
    i == 4: "imp"
    i == 5: "le as"
    i == 6: "it seems"
    

    literally:

    This is not so simple as it seems

    The trailing \0 is to cause the while( arr[ i ] ) to fail and the loop to stop when i == 7.

    Although this will probably cause the compiler to complain on non-microsoft compilers.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

int main(void) { char tmp, arr[100]; int i, k; printf(Enter a string: ); scanf_s(%s,
#include<iostream> using namespace std; int main() { char arr[200]; while(1) { cin >> arr;
I have this code #include <iostream> using namespace std; int main(int argc,char **argv) {
#include<iostream> #include<string> using namespace std; int main() { char arr[1000][80]; char output[1000][80]; int n,i,j;
I think I've got it down to the most basic case: int main(int argc,
Session transcript: > type lookma.c int main() { printf("%s", "no stdio.h"); } > cl
The code says at many places invalid indirection.Please help. int main() { char *s1,*s2,*position;
Consider #include <cstdio> int main() { char a[10]; char *begin = &a[0]; char *end
#include<stdio.h> int main() { char *p=mystring; return 0; } String literal mystring, where will
Why do we at all use integers in C? #include<stdio.h> int main() { char

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.