+ 2
C program to create two sets and print the difference of the sets, explain plzz ??
In (A - B) form
4 Answers
+ 2
Make your question more descriptive. What sets? There are no standard library sets in C. What you're talking about?
+ 1
Okay now it's good. Show your attempt. We don't just give answers to questions, show your attempt and tell where you went wrong.
Hint: This question can be approached by using arrays. Get in the length of two sets, create arrays of that size and get the sets as input. Then create a function that takes in the two sets (arrays) and returns a new set (array) with the elements in A but not in B
0
You can use array as a sets if u want that your array doesn't consists duplicate elements then u can use any method to remove duplicate method . Take two array first one for set1 second one for set2
I suppose there is no duplicate elements .
Then u need to use two loop
for i to ....n
for j to ..n
//here in if condition u can write like this
if(set1[i]==set2[j]) put values here one by one u will understood better
Then print
Esle
continue;
NOTE : first try on pen paper
0
https://code.sololearn.com/cy3lirStMq3z/?ref=app
This code is providing A-B B-A and SYMMETRIC DIFFERENCE
ALL THE 3 ASPECTS