online compiler and debugger for c/c++

code. compile. run. debug. share.
Source Code    Language
/****************************************************************************** Welcome to GDB Online. GDB online is an online compiler and debugger tool for C, C++, Python, PHP, Ruby, C#, VB, Perl, Swift, Prolog, Javascript, Pascal, HTML, CSS, JS Code, Compile, Run and Debug online from anywhere in world. *******************************************************************************/ #include <stdio.h> int main() { // "a" - КОНСТАНТНЫЙ (так задумано, хотя явно не написано) указатель на первый элемент массива (на 1) // то есть в переменной "a" лежит адрес памяти, а по этому адресу памяти лежит целое число 1 // "a" нельзя изменить! // a = 0; // error: assignment to expression with array type int a[] = {1, 2, 3}; // "b" - просто указатель // в переменной "b" лежит адрес, в данном случае тот же адрес, что в "a" // "b" - МОЖНО изменить! // b = 0; // no error // кстати, синтаксис что-то={что-то в фигурных скобочках} работает только для массивов // то есть нельзя написать int* b = {4, 5}; // int* b = {4, 5}; // warning: initialization makes pointer from integer without a cast [-Wint-conversion] int* b = a; printf("Внутри a лежит адрес %p и внутри b лежит тот же адрес %p\n", a, b); printf("%d %d\n", a[0], *b); return 0; }

Compiling Program...

Command line arguments:
Standard Input: Interactive Console Text
×

                

                

Program is not being debugged. Click "Debug" button to start program in debug mode.

#FunctionFile:Line
VariableValue
RegisterValue
ExpressionValue