far pointer

Jul 8, 2014 at 7:57am
whenever i run this code it gives an error saying
1
2
3
4
5
C:\Users\Mehak\Desktop\Untitled2.c||In function 'main':|
C:\Users\Mehak\Desktop\Untitled2.c|4|error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token|
C:\Users\Mehak\Desktop\Untitled2.c|4|error: 'scm' undeclared (first use in this function)|
C:\Users\Mehak\Desktop\Untitled2.c|4|note: each undeclared identifier is reported only once for each function it appears in|
||=== Build finished: 2 errors, 0 warnings (0 minutes, 0 seconds) ===|

please help!
1
2
3
4
5
6
7
#include <stdio.h>
int main()
{
    char far *scm;
    printf("%d",sizeof(scm));
}
Jul 8, 2014 at 8:05am
remove 'far'

Though if you want to get the size of char pointer, you can do sizeof(char*).
Last edited on Jul 8, 2014 at 8:05am
Jul 8, 2014 at 8:06am
no actually i need this far pointer in a program thats y
Jul 8, 2014 at 8:08am
closed account (z05DSL3A)
A far pointer is a pointer that points outside of a segment in a system with segmented architecture (think 16-bit x86). I would hazard a guess that you are not using such an computer/compiler.

Where are you getting your code from?
Jul 8, 2014 at 8:17am
Huh, I didn't know far pointers were even a thing. From what I've found, they aren't supported in modern compilers, which is why you got the errors you did.
Topic archived. No new replies allowed.