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 8457701
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T12:52:36+00:00 2026-06-10T12:52:36+00:00

char* a=dsa qwe; printf(%s, a); output: dsaqwe My question is why does this thing

  • 0
char* a="dsa" "qwe";
printf("%s", a);

output: dsaqwe

My question is why does this thing work. If I give a space or nothing in between two string literals it concatenates the string literals.

How is this working?

  • 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-06-10T12:52:38+00:00Added an answer on June 10, 2026 at 12:52 pm

    It’s defined by the ISO C standard, adjacent string literals are combined into a single one.

    The language is a little dry (it is a standard after all) but section 6.4.5 String literals of C11 states:

    In translation phase 6, the multibyte character sequences specified by any sequence of adjacent character and identically-prefixed wide string literal tokens are concatenated into a single multibyte character sequence.

    This is also mentioned in 5.1.1.2 Translation phases, point 6 of the same standard, though a little more succinctly:

    Adjacent string literal tokens are concatenated.

    This basically means that "abc" "def" is no different to "abcdef".

    It’s often useful for making long strings while still having nice formatting, something like:

    const char *myString = "This is a really long "
                           "string and I don't want "
                           "to make my lines in the "
                           "editor too long, because "
                           "I'm basically anal retentive :-)";
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

char *star=*; int space=5; printf(%5s,star); I want to give 5 spaces to my star
char label[8] = abcdefgh; char arr[7] = abcdefg; printf(%s\n,label); printf(%s,arr); ====output========== abcdefgh abcdefgÅ Why
char i; for(i=0;i<16;i++) printf(%c,asdf[i]); i=1; if(123[i]==1) i=1; if(456[4]==1) i=1; if(789[1]==1) i=1; The output is:
char imei_temp[14] = {0, }; strcpy(imei_temp, 00000000000000); According to my understanding this is valid
{ char *a, *b; printf(%lx\n,(b-a)); } Usually works, in fact, I can't imagine it
char b; operator<<(cout,(operator>>(cin,b))); this is not compiling in vc++ because all 8 overloads cant
char buffer_b[5] = { 0xDA, 0x00, 0x04, 0x00, 0x07 }; printf(%d\n%d\n%d, buffer_b[0], buffer_b[2], buffer_b[4]);
char character = 'c'; string str = null; str = character.ToString();//this is ok char[]
char *myfunc() { char *temp = string; return temp; } In this piece of
char dict[N][M]; for(i = 0; i < N; i++) { do { printf(enter word

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.