2
How to modify the contents of a root using a pointer?
Write a code in C that uses a variable with the name 'root', have the type 'float' and have the initial value 3.1415.
In this same code, use another variable with the name ' pointing to root' that allows you to store the memory address of the above-mentioned root ? .
Finally, modify the contents of the variable root átiroot' by the variable '_para_root' so that the value of root' is 3.141592. At the end of the code, use printf to print on the screen the value of the 'root' variable.
From 3.1415 to 3.141592
#include <stdio.h>
int main()
{
float raiz = 3.1415;
int *aponta_para_raiz;
printf(" RAIZ = %f\n", raiz );
printf (" RAIZ MODIFICADA = %d", *aponta_para_raiz);
return 0;
}
printf("MODIFIED ROOT = %f", *pointing to root); //I don’t think it’s necessary (Really, it’s not necessary!)
– Diego Roney