above codes show errors about: missing terminating " character 18 | fprintf(temp, "%d %d | ^~~~~~
Question
above codes show errors about: missing terminating " character 18 | fprintf(temp, "%d %d | ^~~~~~
Solution
It seems like you're trying to print two integers to a file using the fprintf function in C, but you're missing the closing quotation mark for the format string. Here's how you can fix it:
- Identify the line where the error is occurring. In this case, it's line 18.
- Look at the syntax of the
fprintffunction. It should look something like this:fprintf(file_pointer, "format string", variable1, variable2, ...). - In your case, it seems like you're trying to print two integers, so your format string should be
"%d %d". However, you're missing the closing quotation mark. - Correct the line to include the closing quotation mark. It should look like this:
fprintf(temp, "%d %d", integer1, integer2);(replaceinteger1andinteger2with the variables you're trying to print). - Save your changes and recompile your program. The error should be gone now.
Similar Questions
Which of the following is an invalid specifier for the printf statement? %4c You Answered %10b %6d Correct answer %8.2d %10.2e
VariablesIf char c = -'a', find output of the statement,printf("%d", c);Options-97-aCompilation Error-6565
Compiler Message/home/ubuntu/Main.cpp:20:20: warning: missing terminating " character 20 | printf("Invalid type entered! | ^/home/ubuntu/Main.cpp:20:20: error: missing terminating " character 20 | printf("Invalid type entered! | ^~~~~~~~~~~~~~~~~~~~~~/home/ubuntu/Main.cpp:21:1: warning: missing terminating " character 21 | "); | ^/home/ubuntu/Main.cpp:21:1: error: missing terminating " character 21 | "); | ^~~/home/ubuntu/Main.cpp:27:20: warning: missing terminating " character 27 | printf("Integer: %d | ^/home/ubuntu/Main.cpp:27:20: error: missing terminating " character 27 | printf("Integer: %d | ^~~~~~~~~~~~/home/ubuntu/Main.cpp:28:1: warning: missing terminating " character 28 | ", *(int*)value); | ^/home/ubuntu/Main.cpp:28:1: error: missing terminating " character 28 | ", *(int*)value); | ^~~~~~~~~~~~~~~~~/home/ubuntu/Main.cpp:31:20: warning: missing terminating " character 31 | printf("Float: %.2f | ^/home/ubuntu/Main.cpp:31:20: error: missing terminating " character 31 | printf("Float: %.2f | ^~~~~~~~~~~~/home/ubuntu/Main.cpp:32:1: warning: missing terminating " character 32 | ", *(float*)value); | ^/home/ubuntu/Main.cpp:32:1: error: missing terminating " character 32 | ", *(float*)value); | ^~~~~~~~~~~~~~~~~~~/home/ubuntu/Main.cpp: In function ‘int main()’:/home/ubuntu/Main.cpp:22:13: error: expected primary-expression before ‘return’ 22 | return 0; | ^~~~~~/home/ubuntu/Main.cpp:29:13: error: expected primary-expression before ‘break’ 29 | break; | ^~~~~/home/ubuntu/Main.cpp:33:13: error: expected primary-expression before ‘break’ 33 | break; | ^~~~~Sample TestcaseTestcase 1 - FailedExpected OutputInteger: 4OutputTestcase 2 - FailedExpected OutputFloat: 5.50OutputTestcase 3 - FailedExpected OutputInvalid type entered!
The following code gives this incorrect output.Which of the following statements about what is causing the error is true? (select all valid answers)carrie@ubuntu:/debugging$ cat main.c #include <stdio.h> /** * main - debugging example * Return: 0 */ int main(void) { int i; int j; for (i = 0; i < 10; i++) { j = 0; while (j < 10) { printf("%d", j); } printf("\n"); } return (0); } carrie@ubuntu:/debugging$carrie@ubuntu:/debugging$ gcc -Wall -Werror -Wextra -pedantic main.c carrie@ubuntu:/debugging$ ./a.out0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 <...>^Ccarrie@ubuntu:/debugging$j never increments so it will always be less than 10j never increments so it is always going to print 0j is always equal to i so the loop will never endI don't know
What is the result of printf("%d", 1 && 2);?
Upgrade your grade with Knowee
Get personalized homework help. Review tough concepts in more detail, or go deeper into your topic by exploring other relevant questions.