Line Splicing in C/C++

While writing a program, sometimes we give comment about the working of the code in the comment section with the help of single/double comment line. But we had never thought that if at the end of this comment line if we use (backslash) character then what will happen?

The answer of the above question is line Splicing. Lines terminated by a are spliced together with the next line very early in the process of translation. §2.2 Phases of translation.
Actually whenever at the end of the comment line if we use (backslash) character then it deletes the backslash character and the preceding next line of code only from the entire program or we can say that the ending (backslash) makes the new line also as a comment for the compiler.

// C program to illustrate the concept of Line splicing.
#include <stdio.h>
int main()
    // Line Splicing
    printf("Hello GFG ");
    return (0);



Explanation: In the above program as we can see when we use the (backslash) character at the end of comment line. Then the next line of code is treated as comment in the program and the output is welcome.

Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.

This article is attributed to GeeksforGeeks.org



You Might Also Like

leave a comment



load comments

Subscribe to Our Newsletter