How does the following printf function work?
All the data types to display are entered before hand and all the text is entered afterwards. I've never seen this before.Code:printf("%s\"%s\"\n%s%ld\n%s\"%s\"\n%s%ld\n",
"The original string is ", string,
"The converted value is ", x,
"The remainder of the original string is ",
remainderPtr,
"The converted value plus 567 is ", x + 567 );
Complete code below if needed
Code:#include <stdio.h>
#include <stdlib.h>
int main()
{
long x;
const char *string = "-1234567abc";
char *remainderPtr;
x = strtol( string, &remainderPtr, 0 );
printf("%s\"%s\"\n%s%ld\n%s\"%s\"\n%s%ld\n",
"The original string is ", string,
"The converted value is ", x,
"The remainder of the original string is ",
remainderPtr,
"The converted value plus 567 is ", x + 567 );
return 0;
}