What is a void pointer?
Void pointer is a generic pointer in programming. If the pointer type is unknown, we make use of the void pointer.
List some applications of C programming language?
Application of C Programming Language
-
To develop embedded software
-
It is to create a computer application
-
It is effective to create a compiler for various computer languages to convert them into low-level language that is the machine understandable language.
-
It can be used to develop an Operating system and UNIX is one which is developed by the C .programming language.
-
It is used for creating software for various applications and even hardware.
When can you use a pointer with a function?
A pointer can be used with a function-
-
When an address is to be passed to a function
-
When array elements are to be accessed through a function. Passing base address will give access to the whole array.
Write program to remove duplicate in an array ?
C program to remove duplicate programme:
#include <stdio.h>
int main()
{
int n, a[100], b[100], calc = 0, i, j;
printf("Enter no. of elements in array\n");
scanf("%d", &n);
printf("Enter %d integers\n", n);
for (i = 0; i < n; i++)
scanf("%d", &a[i]);
for (i = 0; i<n; i++)
{
for (j = 0; j < calc; j++)
{
if(a[i] == b[j]) break;
}
if (j== calc)
{
b[count] = a[i]; calc++;
}
}
printf("Array obtained after removing duplicate elements:\n");
for (i = 0; i < calc; i++)
printf("%d\n", b[i]);
return 0;
}
Is there any data type in C with variable size?
Yes, Struct is one of the datatype in C that have variable size. It is because the size of the structure depends on the fields which can be variable as set by the user.
Is there any demerits of using pointer?
Yes. As pointers have access to a particular memory location, the security level decreases and restricted memory areas can be accessed. Other demerits include memory holes, process and memory panics, etc.
What is typecasting?
Typecasting is a way to convert a variable/constant from one type to another data type.
If the size of int data type is two bytes, what is the range of signed int data type?
The range of signed int data type if from -32768 to 32767.
List some applications of C programming language?
Application of C Programming Language
-
To develop embedded software
-
It is to create a computer application
-
It is effective to create a compiler for various computer languages to convert them into low-level language that is the machine understandable language.
-
It can be used to develop an Operating system and UNIX is one which is developed by the C .programming language.
-
It is used for creating software for various applications and even hardware.
How can you find the exact size of a data type in C?
One can determine the exact size of a data type by using the sizeof operator. The storage size of the data type is obtained in bytes by using the syntax: sizeof(data_type).
.png)