M
Michael DeWulf
Why does the code in example 1 output 100 and the code in example 2 output
4? Rather, I understand example 2's output, but why doesn't example 1
also output 4?
-Mike
----Example 1----
#include <iostream>
using namespace std;
int main()
{
char c[100];
cout << sizeof(c) << endl;
return 0;
}
----Example 2----
#include <iostream>
using namespace std;
int main()
{
char * c = "what's up?";
cout << sizeof(c) << endl;
return 0;
}
4? Rather, I understand example 2's output, but why doesn't example 1
also output 4?
-Mike
----Example 1----
#include <iostream>
using namespace std;
int main()
{
char c[100];
cout << sizeof(c) << endl;
return 0;
}
----Example 2----
#include <iostream>
using namespace std;
int main()
{
char * c = "what's up?";
cout << sizeof(c) << endl;
return 0;
}