You are here:

C++/a compiling error


sorry for taking your time.
I have read a program for making subsets of a set,but I have a compiling error:
that can not change int to const char.
please help me in this error and tell me which changes should I make.
c++ version:4.5 for windows

my program:


void subset(char [],char [],int);

int j=0;
char set[15];
cout<<"enter the set to take subsets for:\n";
subset(set," ",j);
return 0;

void subset(char mainset[],char calledset[],int i)
 int length=strlen(mainset);
 char str[15];


 strcat(str," ");

take care of yourself and goodbye.

Dear Sara,
Thankyou for your question. Well, first of all
you should make the changes later, let me comment
on the main error why your program is not running.

Please check the prototype of the function which
you have given like

void subset( char [], char [], int )

and in the function call you are sending something

subset( madeset, "" , j )

It is giving me a mismatch error, an array doesnt
compensate for a null space. So i guess you should
better remove this error. Secondly your array wont
take the input correct. You've declared a single
dimensional array and you have declared it like this

char a[15]

cout<<"enter the input:";

it would only interpret it as a single character your
whole set wouldnt be entered, you need a loop or some
condition, that how many elements you need to enter.
I guess first remove these errors, and let me know if
you cant get the logic working still.

Hope this helps,


All Answers

Answers by Expert:

Ask Experts




I can answer any question about functions,pointers,structures,object oriented programming basics of classes and data structures.My strong field is structured programming.


I have got 2 years experiece under C . I am able to answer about the structured concepts pointers to a little extent,OOP concepts. I have also experience in data Strucutres like Linked List, Stacks , Queues, Heaps, B Trees, Red Black Trees. I will try to satisfy with my knowledge. I am the Student of an expert here Martin, what i have learnt today, i just owe my every knowledge to him. He is the greatest.

©2016 All rights reserved.