Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to view global variables while debugging [duplicate]

How can i watch global pointer variable root in Visual Studio Code?

Here is the sample:

#include <stdio.h>
#include <stdlib.h>
#include <windows.h>
#include "pch.h"
#include <iostream>

struct node
{
    int data;
    struct node *link;
};

struct node *root;
like image 368
Varun Avatar asked Dec 21 '25 08:12

Varun


1 Answers

enter debug mode (F5)

Add variable to watch (Right click on *root - Add to watch)

value will be shown in watch window during debug execution

like image 108
HAL9000 Avatar answered Dec 23 '25 22:12

HAL9000



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!