I just started learning C language and i have a basic question.
#include <stdio.h>
int main() {
// These variables have been assigned hidden values:
int secret;
int *another_secret;
// Declare a variable named secret_pt and make it point to secret:
// Add the value at the address pointed to by another_secret to the
// value at the address pointed to by secret_pt.
// Do not change the address assigned to secret_pt, and don't explicitly set secret.
return 0;
}
Here is my approach;
#include <stdio.h>
int main() {
// These variables have been assigned hidden values:
int secret;
int *another_secret;
// Declare a variable named secret_pt and make it point to secret:
// int *secret_pt;
//secret_pt = &secret;
int *secret_pt = &secret;
// Add the value at the address pointed to by another_secret to the
// value at the address pointed to by secret_pt.
// Do not change the address assigned to secret_pt, and don't explicitly set secret.
int *secret = *another_secret;
return 0;
}
But i'm getting redefining error which makes sense but i don't know how to solve it.