logo

CuriousTab

CuriousTab

Discussion


Home Technical Questions Programming See What Others Are Saying!
  • Question
  • How would you check whether the contents of two structure variables are same or not?


  • Correct Answer
  • struct emp { char n[20]; int age; }; main() { struct emp e1 = {"Dravid", 23}; struct emp e2; scanf ("%s %d",e2n, & e2age); if( structcmp (e1,e2) ==0) printf ("The structures are equal"); else printf ("The structures are unequal"); } structcmp ( struct emp x, struct emp y) { if (strcmp (xn,yn) ==0) if (xage == yage) return (0); return (1); } In short, if you nee to compare two structures, you'll have to write your own function to do so which carries out the comparison field by field 


  • More questions

    • 1. What does microprocessor speed depend on?
    • Discuss
    • 2. What does RSI stand for?
    • Discuss
    • 3. Which Stack is used in 8086?
    • Discuss
    • 4. What is object repository?
    • Discuss
    • 5. Which is the Stack used in 8085?
    • Discuss
    • 6. What does GUI stand for?
    • Discuss
    • 7. What is the main reason the OSI Model was created?
    • Discuss
    • 8. Ethernet uses which topology

    • Options
    • A. Star
    • B. Bus
    • C. Twisted pair
    • D. Both B & C
    • Discuss
    • 9. What are various scheduling queues?
    • Discuss
    • 10. What is the state of the processor, when a process is waiting for some event to occur?
    • Discuss


    Comments

    There are no comments.

Enter a new Comment