Knowee
Questions
Features
Study Tools

Point out the error line in the following program.1    #include <iostream>2    using namespace std;3    void main()4    {5    long int num = 10;      6    long int *ptr;                  7    cout<<"num's address :"<< &num<<"\n";   8    ptr = &num;9    cout<<"pointer's address :"<< &ptr<<"\n";   10  cout<<"pointer's size bytes "<< sizeof(ptr)<<"\n";  11  cout<<"pointer's value: "<< ptr<<"\n";   12  cout<<"value pointed to: "<< *ptr<<"\n";  13  return 0;14  }Select one:Line number 5Line number 12Line number 3Line number 10

Question

Point out the error line in the following program.1    #include <iostream>2    using namespace std;3    void main()4    {5    long int num = 10;      6    long int *ptr;                  7    cout<<"num's address :"<< &num<<"\n";   8    ptr = #9    cout<<"pointer's address :"<< &ptr<<"\n";   10  cout<<"pointer's size bytes "<< sizeof(ptr)<<"\n";  11  cout<<"pointer's value: "<< ptr<<"\n";   12  cout<<"value pointed to: "<< *ptr<<"\n";  13  return 0;14  }Select one:Line number 5Line number 12Line number 3Line number 10

...expand
🧐 Not the exact question you are looking for?Go ask a question

Solution

The error is in line number 3. In C++, the correct way to define the main function is either "int main()" or "int main(void)", not "void main()".

Similar Questions

When the following code is executed an error is encountered and the program crashes. On which line do you think the error is encountered?You may assume that all required classes have been defined elsewhere.

Point out the error line in the following program.1    #include <iostream>2    using namespace std;3    void main()4    {5    long int num = 10;      6    long int *ptr;                  7    cout<<"num's address :"<< &num<<"\n";   8    ptr = &num;9    cout<<"pointer's address :"<< &ptr<<"\n";   10  cout<<"pointer's size bytes "<< sizeof(ptr)<<"\n";  11  cout<<"pointer's value: "<< ptr<<"\n";   12  cout<<"value pointed to: "<< *ptr<<"\n";  13  return 0;14  }Select one:Line number 5Line number 12Line number 3Line number 10

If the code throws an error, in which line will it occur? Enter an integer between 1 and 7, both endpoints included.

Point out the error line in the following program.1. #include<stdio.h>2.  int main()3.  {4.      int i;5.      for(i=5;i<1;i--);6.      break;7.      for(i=6;;i--)8.      {9.          if(i=3)10.          {11.              break;12.          }13.      }14.      for(;;)15.      break;16.      if(i -= 3)17.      printf("%d\n", i);18.      return 0;19.  }

Point out the error line in the following program.  1.    #include<stdio.h> 2.     int main() 3.     { 4.         int i = 1; 5.         switch(i) 6.         { 7.             printf("This is c program."); 8.             case 1: 9.                 printf("Case1"); 10.                 break; 11.             case 2 12.                 printf("Case2"); 13.                 break; 14.         } 15.     return 0; 16.     }

1/4

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.