RE: [Dev-C++] char Array - DevC++ beginner...
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: <Sen...@De...> - 2003-06-17 04:07:07
|
-----Original Message-----
From: Aurea Janine Loveless [mailto:jan...@ho...]
Sent: Monday, June 16, 2003 11:39 PM
To: dev...@li...
Subject: [Dev-C++] char Array - DevC++ beginner...
I am trying to create an array type char in Dev++ like this:
Greetings.
#include <iostream.h>
#include <stdlib.h>
#include <string>
int main()
{
char Name[];
[OR, Senthil] Array Size should be declared to compiler when not
intialized. For eg, you can use char Name[] = { 'J'}; but not char name[];
Name[1]="J";
The const char * error refers herein where there is confusion to the
compiler if it has to use address in the string or as an array.
cout << sizeof(Name);
Cout undeclared error occurs coz you havent used using namespace std;
system("PAUSE");
return 0;
}
and DevC++ is telling me that the array size is missing and that assig to
"char" from "const char" lacks a cast.
Anyone could please help me with what I am doing wrong?
[OR, Senthil]
This should work fine now.
#include <iostream>
#include <stdlib.h>
#include <string>
int main()
{
using namespace std;
char Name[1];
Name[0]='J';
cout<<sizeof(Name);
system("PAUSE");
return 0;
}
Thanks.
Janine
Cheers!
Senthil
_____
Add photos to your messages with MSN 8.
<http://g.msn.com/8HMEENUS/2749??PS=> Get 2 months FREE*.
------------------------------------------------------- This SF.NET email is
sponsored by: eBay Great deals on office technology -- on eBay now! Click
here: http://adfarm.mediaplex.com/ad/ck/711-11697-6916-5
_______________________________________________ Dev-cpp-users mailing list
Dev...@li... TO UNSUBSCRIBE:
http://www.noicys.cjb.net/devcpp/ub.htm
https://lists.sourceforge.net/lists/listinfo/dev-cpp-users
|