DevScript Saga

Welcome to DevScript Saga!

A little Helping Hand for Devs

What is Dangling pointer?
Ans: Dangling Pointer is a pointer that doesn’t point to a valid memory location. Dangling pointers arise when an object is deleted or de-allocated, without modifying the value of the pointer, so that the pointer still points to the memory location of the de-allocated memory.

Why is C called a mid-level programming language?

C is called a mid-level programming language because it binds the low level and high -level programming language. We can use C language as a System programming to develop the operating system as well as an Application programming to generate menu driven customer driven billing system

What is the use of a static variable in C?

Following are the uses of a static variable:

  • A variable which is declared as static is known as a static variable. The static variable retains its value between multiple function calls.
  • Static variables are used because the scope of the static variable is available in the entire program. So, we can access a static variable anywhere in the program.
  • The static variable is initially initialized to zero. If we update the value of a variable, then the updated value is assigned.
  • The static variable is used as a common value which is shared by all the methods.
  • The static variable is initialized only once in the memory heap to reduce the memory usage.

What is a union?

  • The union is a user-defined data type that allows storing multiple types of data in a single unit. However, it doesn’t occupy the sum of the memory of all members. It holds the memory of the largest member only.
  • In union, we can access only one variable at a time as it allocates one common space for all the members of a union.

Can we compile a program without main() function?

Yes, we can compile, but it can’t be executed. But, if we use #define, we can compile and run a C program without using the main() function

Leave a comment