You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
it seems like parameters being reassigned inside a function aren't reflected in the visualizer
bug report:
Hello,
In the below program after the ptr is loaded with &x,it should point to x,but the visualizer is not doing that ,but the output is right i.e 21 .Can you please explain me why this is happening ?Is it because of somebug or something else?
#include <stdio.h>
int fun(int ptr[])
{
int x = 21;
// size of a pointer is printed
printf("sizeof(ptr) = %d\n", sizeof(ptr));
// This allowed because ptr is a pointer, not array
ptr = &x;
printf("*ptr = %d ", *ptr);
return 0;
}
int main()
{
int arr[] = {10, 20, 30, 40, 50, 60};
fun(arr);
return 0;
}
The text was updated successfully, but these errors were encountered:
Hello Philip!
I think that there is a small bug in the C Tutor. If I try the execution of the following code:
#include <stdio.h>
void funcionValor(int a, int b); /*prototipo*/
int main() {
int x = 2;
int y = 5;
funcionValor(x, y);
return 0;
}
void funcionValor(int a, int b) {
//printf("%d\t, %d\n", a, b); // <-- uncomment and IT WORKS
a=0;
b=0;
return;
}
The value of a and b don't change in the visualization of the stack. But if I put the previous line printf("%d\t, %d\n", a, b); then it's ok.
PG note: WOW that's weird, if you do a printf beforehand, then the visualizer DOES UPDATE properly, whoa whoa whoa!!!
it seems like parameters being reassigned inside a function aren't reflected in the visualizer
bug report:
Hello,
In the below program after the ptr is loaded with &x,it should point to x,but the visualizer is not doing that ,but the output is right i.e 21 .Can you please explain me why this is happening ?Is it because of somebug or something else?
The text was updated successfully, but these errors were encountered: