Line Splicing 

In C and C++ you can join the next line to the current line using Line spicing. Requires ‘\’ to be added at the end of the line.

 

Example code to demostrate line splicing.

[yogi@192 devel]$ cat linesplice.c
#include <stdio.h>

int main(int argc, char *argv[])
{
// test line splice
printf(“Hello\n”);
printf(“World\n”);

return 0;
}
[yogi@192 devel]$ gcc -o linesplice linesplice.c
[yogi@192 devel]$ ./linesplice
Hello
World
[yogi@192 devel]$ vi linesplice.c
[yogi@192 devel]$ cat linesplice.c
#include <stdio.h>

int main(int argc, char *argv[])
{
// test line splice \
printf(“Hello\n”);
printf(“World\n”);

return 0;
}
[yogi@192 devel]$ gcc -o linesplice linesplice.c
[yogi@192 devel]$ ./linesplice
World
[yogi@192 devel]$ vi linesplice.c
[yogi@192 devel]$ gcc -o linesplice linesplice.c
[yogi@192 devel]$ cat linesplice.c
#include <stdio.h>

int main(int argc, char *argv[])
{
// test line splice \
printf(“Hello\n”); \
printf(“World\n”);

return 0;
}
[yogi@192 devel]$ ./linesplice
[yogi@192 devel]$

 

Source: Line Splicing in C/C++ – GeeksforGeeks

About the Author

Yogi

21 years of experience in various layers of software. Primarily experienced in system side software design and development on server management software. Interested in linux development in x86 and arm architecture.