Skip to content

Tag Archives: Structure & Union

In this article, we will discuss structures, unions, and enumerations and their differences. The structure is a user-defined data type that is available in C++.… Read More
Class: It is a user-defined datatype enclosed with variables and functions. It is like a blueprint for an object. Class members are private by default.… Read More
Given an array arr[] containing N distances of inch-feet system, such that each element of the array represents a distance in the form of {inch,… Read More
Predict the output of following C program #include<stdio.h> struct Point {   int x, y, z; };    int main() {   struct Point p1 = {.y… Read More
# include <iostream> # include <string.h> using namespace std;    struct Test {   char str[20]; };    int main() {   struct Test st1, st2;   strcpy(st1.str,… Read More
union test {     int x;     char arr[4];     int y; };    int main() {     union test t;     t.x = 0;     t.arr[1] = 'G';     printf("%s", t.arr);… Read More
union test {     int x;     char arr[8];     int y; };    int main() {     printf("%d", sizeof(union test));     return 0; } Predict the output of above… Read More
Which of the following operators can be applied on structure variables? (A) Equality comparison ( == ) (B) Assignment ( = ) (C) Both of… Read More
#include<stdio.h>  struct st  {      int x;      struct st next;  };       int main()  {      struct st temp;      temp.x = 10; = temp;      printf("%d",; … Read More
Consider the following C declaration struct {      short s[5];     union {           float y;           long z;      }u;  } t; Assume that objects of the type short,… Read More
struct node  {     int i;     float j;  };  struct node *s[10]; The above C declaration define ‘s’ to be (GATE CS 2000) (A) An array,… Read More
Assume that size of an integer is 32 bit. What is the output of following program? #include<stdio.h> struct st {     int x;     static int y;… Read More
#include‹stdio.h› int main() {     struct site     {         char name[] = "GeeksQuiz";         int no_of_pages = 200;     };     struct site *ptr;     printf("%d ", ptr->no_of_pages);     printf("%s", ptr->name);     getchar();… Read More

Start Your Coding Journey Now!