C query
Please make me understand the output of the following code:-
#include<stdio.h>
void main()
{
char *s1;
char far *s2;
char huge *s3;
printf("%d %d %d ",sizeof(s1),sizeof(s2),sizeof(s3));
}
Member • Aug 24, 2009
i know answer of 1st 1 byte,4 byte,4bytece_nehaHi ,
Please make me understand the output of the following code:-
#include<stdio.h>
void main()
{
char *s1;
char far *s2;
char huge *s3;
printf("%d %d %d ",sizeof(s1),sizeof(s2),sizeof(s3));
}
Member • Aug 26, 2009
Member • Sep 1, 2009
Member • Sep 10, 2009
Member • Sep 10, 2009
The program gives errors on compiling.devil_radsI just ran the program and it is showing the output as 2 4 4....
Can u please elaborate your ans...
#include<stdio.h> void main() { char *s1; char *s2; char *s3; printf("%d %d %d ",sizeof(s1),sizeof(s2),sizeof(s3)); getch(); }Output: 4 4 4
Member • Sep 13, 2009
Member • Sep 14, 2009
char *s1;What is far and huge ?
char far *s2;
char huge *s3;
Member • Sep 14, 2009
ce_nehaHi ,
Please make me understand the output of the following code:-
#include<stdio.h>
void main()
{
char *s1;
char far *s2;
char huge *s3;
printf("%d %d %d ",sizeof(s1),sizeof(s2),sizeof(s3));
}
Member • Sep 16, 2009
As per my knowledge:ce_nehaHi ,
Please make me understand the output of the following code:-
#include<stdio.h>
void main()
{
char *s1;
char far *s2;
char huge *s3;
printf("%d %d %d ",sizeof(s1),sizeof(s2),sizeof(s3));
}
Member • Sep 16, 2009
brahmaasthraFirst one char *str : str is a pointer variable which stores an address of a char datatype. So the size is 2 bytes (default). In which you can address from (0000)hexa to (FFFF)hexa. you cant go beyond that.
Second one is char far *str: far pointer increases the addressable locations. where you can give address ranges from (00000000)hexa to (FFFFFFFF)hexa. Ex:- for the monitor output the address is 0800 0000 hexa.
Third one is char huge *str: when far pointer overflows ie gets incremented from (FFFFFFFF) + 1 it again goes to (00000000) hexa. The address is inside the same process.
But in the case of huge if it gets overflow (FFFFFFFF)+1 it goes to the next process 1 0000 0000 hexa.