Identify the error in the following program.
include<iostream>
using namespace std;
void main()
{
int num[]={1,2,3,4,5,6};
num[1]==[1]num ? cout<<"Success" : cout<<"Error";
}

Answer Posted / hr

num [1] = [1] num?. You should write index number after array name but here index number is mention before array name in [1] num
So expression syntax error will be shown.
Correction : num[1] = num[1]? is the correct format.

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What does the ios::ate argument do?

668


What is static modifier?

636


Can a program run without main function?

624


What is an overflow error?

626


Differentiate between an inspector and a mutator ?

709






What is the word you will use when defining a function in base class to allow this function to be a polimorphic function?

675


What is the 4 difference between delete[] and delete?

538


What is function declaration in c++ with example?

550


How a pointer differs from a reference?

696


What is the difference between member functions and static member functions?

562


Can class objects be passed as function arguments?

611


Explain queue. How it can be implemented?

679


#include #include #include #include void select(char *items, int count); int main(void) { char s[255]; printf("Enter a string:"); gets(s); select(s, strlen(s)); printf("The sorted string is: %s.\n", s); getch(); return 0; } void select(char *items, int count) { register int a, b, c; int exchange; char t; for(a = 0; a < count-1; ++a) { exchange = 0; c = a; t = items[ a ]; for(b = a + 1; b < count; ++b) { if(items[ b ] < t) { c = b; t = items[ b ]; exchange = 1; } } if(exchange) { items[ c ] = items[ a ]; items[ a ] = t; } } } design an algorithm for Selection Sort

2070


Does there exist any way to make the command line arguments available to other functions without passing them as arguments to the function?

752


What is stream and its types in c++?

564