Script
#include <iostream>
using namespace std;
int main()
{
float nums[3];
nums[0]=1.5;
nums[1]=2.75;
nums[2]=3.25;
const char* name[5]={"m", "i", "k", "e", "\0"};
int coords[2][3]={{1, 2, 3}, {4, 5, 6}};
cout << "nums[0]: " << nums[0] << endl;
cout << "nums[1]: " << nums[1] << endl;
cout << "nums[2]: " << nums[2] << endl;
cout << "name[0]: " << name[0] << endl;
cout << "Text String: " << name << endl;
cout << "coords[0][2]: " << coords[0][2] << endl;
cout << "coords[1][1]: " << coords[1][1] << endl;
return 0;
}
Output:
nums[0]: 1.5
nums[1]: 2.75
nums[2]: 3.25
name[0]: m
Text String: 0xffffcbb0
coords[0][2]: 3
coords[1][1]: 5
Question:
How can I make the "Text String: " say "mike"
I tried char name[5],
I tried char* name[5];
Please help
Thank You
I'm new to c++, don't judge