online compiler and debugger for c/c++

code. compile. run. debug. share.
Source Code    Language
/****************************************************************************** Online C++ Compiler. Code, Compile, Run and Debug C++ program online. Write your code in this editor and press "Run" button to compile and execute it. *******************************************************************************/ #include <iostream> #include <string> #include <string.h> using namespace std; int main() { char foo1[20]; // 必须要知道char array的size char foo2[] = {}; // size=0 char foo3[] = {'a', 'b', 'c', '\0'}; // size=4 char foo4[] = ""; // size=1 char foo5[] = "abc"; // size=4 char foo6[20] = "a"; cout<<"foo1: ("<<foo1<<") "<<strlen(foo1)<<" "<<sizeof(foo1)<<endl; // strlen(search for null only) returns a undefined reault here cout<<"foo2: ("<<foo2<<") "<<strlen(foo2)<<" "<<sizeof(foo2)<<endl; cout<<"foo3: ("<<foo3<<") "<<strlen(foo3)<<" "<<sizeof(foo3)<<endl; cout<<"foo4: ("<<foo4<<") "<<strlen(foo4)<<" "<<sizeof(foo4)<<endl; cout<<"foo5: ("<<foo5<<") "<<strlen(foo5)<<" "<<sizeof(foo5)<<endl; cout<<"foo6: ("<<foo6<<") "<<strlen(foo6)<<" "<<sizeof(foo6)<<endl; 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