VARIOUS METHODS TO FIND SIZE OF WITHOUT USING sizeof() OPERATOR
Sizeof is a much used operator in the C programming language. It is a compile time unary operator which can be used to compute the size of its operand. The result of sizeof is of unsigned integral type which is usually denoted by size_t. sizeof can be applied to any data-type, including primitive types such as integer and floating-point types, pointer types, or compound datatypes such as Structure, union etc.
METHODS TO FIND SIZE OF WITHOUT USING sizeof() OPERATOR :
METHODS TO FIND SIZE OF WITHOUT USING sizeof() OPERATOR :
Program to find the size of a variable using Pointers
1
2
3
4
5
6
7
8
9
10
|
#include<stdio.h>
int main(void)
{
int *ptr;
ptr++;
printf("Size of ptr = %d\n",ptr);
return 0;
}
|
Program to implement your own sizeof(), Operator
Program to find the size of a variable using Macro
METHOD 2:
1
2
3
4
5
6
7
8
9
|
|
Program to find the size of a variable using an Array
Thanks for reading Guys. If you have any doubt, please write the comment below. Keep Learning. Happy coding
Very good. Very nice
ReplyDeletethanks
DeleteGreat
ReplyDeleteAre chha gye guru
DeleteThanks
Deletegood work munish
ReplyDeleteThanks sir
DeleteGood article!
ReplyDeleteThanks
DeleteThis comment has been removed by the author.
ReplyDeleteVery helpful codings, thank you!
ReplyDeleteThankyou
DeleteVery good.very helpful.appriciable coding
ReplyDeleteThanks
DeleteThank You
ReplyDelete