Home / MCQ Bank / Computer
Computer Plus Plus Miscellaneous

What will be the output of the following C++ code? #include <stdio.h> int main () { FILE * p; int c; int n = 0; p = fopen ("myfile.txt", "r"); if (p == NULL) perror ("Error opening file"); else { do { c = getc (p); if (c == '$') n++; } while (c != EOF); fclose (p); printf ("%d\n", n); } return 0; }

Select the best option to verify your answer:
Show Correct Answer
Correct Answer: Option C • Count of '$' symbol or Error opening file

Related Computer Questions

In C#, which method is used to write data to a text file? The argument to the function mysql_error() is ______ Which element shows completion progress of a task? Find the postorder traversal of the binary tree shown below. What is the time complexity of deleting the root node in a Binary Search Tree (BST) with two children?