RSS
Follow Us
Contribute
 
 
 
 

Error C2048: more than one default

 
We need YOUR SKILLS in this collaborative work, to build the largest solution center for error messages.

From $1

Table of contents
  1. 1. Cause
  2. 2. Solution

Cause

More than one default values are used inside of a "switch" statement. Ex:

int main()
{
	char ch = 'b';
	int c;
	switch (ch){
		case 'a':
			c = 0;
	                break;
              default:
			c = 1;
	                break;
              default:
			c = 2;
	                break;
              }
}

Solution

Delete one of the "default" keywords.

int main()
{
	char ch = 'b';
	int c;
	switch (ch){
		case 'a':
			c = 0;
	                break;
              default:
			c = 1;
	                break;
              }
}

 
 
 
 
Comments