why arithmetic operation can’t be performed on a void pointer?
Hav an example with an int pointer,
assume compiler allocates two bytes for an int.
int *iptr, iArray[3] = {1, 2, 3};
/*say the iArray starting address would be 1000*/
iptr = iArray[0];
/*When u r trying to do iptr++ then it will point to 1002
(two bytes for an int) where element 2 available.
cos compiler knows how many bytes has two increment*/
iptr++;
Now come to void:
void pointer is generic pointer which can be point to any
kind of data types.
void *ptr;
/*When u r trying to do ptr++, since it is void pointer, it
will not know exactly how many bytes has to be incremented.
So that arithmatic operations not possible with void
pointer.*/
Is This Answer Correct ? | 4 Yes | 0 No |
Explain what will the preprocessor do for a program?
Write a C program to fill a rectangle using window scrolling
Why array starts with index 0
What is c++ used for today?
why TCS selected more student in the software field from all institution.
Why do we use static in c?
What are the advantages of external class?
2. Counting in Lojban, an artificial language developed over the last fourty years, is easier than in most languages The numbers from zero to nine are: 0 no 1 pa 2 re 3 ci 4 vo 5 mk 6 xa 7 ze 8 bi 9 so Larger numbers are created by gluing the digit togather. For Examle 123 is pareci Write a program that reads in a lojban string(representing a no less than or equal to 1,000,000) and output it in numbers.
in linking some of os executables are linking name some of them
the constant value in the case label is followed by a a) semicolon b) colon c) braces d) none of the above
Is there any possibility to create customized header file with c programming language?
what is the first address that gets stored in stack according to a C or C++ compiler???? or what will be the first address that gets stored when we write a C source code????????