If anyone, please give me an idea what pointers are? The simplest that I could understand... please?
I saw lots of programs that use pointers, and I don't get it why is it so important...
I have posted here in the message board titled: "printing from output..."
..there's a code there I posted which I got somewhere from the internet, and there's this asterisk(*) thing, arrggghhh, I just don't get it... lol,, xD
What's the (*) sign's use and also, what's the (&) sign's use?
btw, here's the code I posted from the aforementioned post:
and here's a quoted message:Code:#include<stdio.h>
#include<stdlib.h>
int main(void)
{
FILE *testFile;
int age;
char name[40];
system("cls");
testFile = fopen("c:\\testFile.txt", "w");
printf("\n\n\tEnter your name here: ");
gets(name);
printf("\tEnter your age here: ");
scanf("%i", &age);
fprintf(testFile, "The name you have inputed is: %s", name);
fprintf(testFile, "\nYour age is: %i", age);
fclose(testFile);
return 0;
}
I don't get it what he's trying to say.. I don't want to ignore the fact it's a pointer.. I really want to know what pointers are... So if anyone, please help me understand what pointers are.. thanks in advance... Merry Christmas and Happy New Year... ^.^Quote:
FILE *testFile declares a pointer to a FILE object. It must be a pointer (unless you REALLY want to get yourself in deep water).
For now, you can ignore the fact that it is a pointer, tho' - because the way you'll use it throughout your life as a programmer is just "an identifier of a file" - the fact that it happens to be a pointer or that it's pointing to a file object is as meaningful as knowing the stoichometric mixture values for fuel and air in an engine when driving a car - pointless.