hi
char * temp=new char[200];
temp[0]=1;
temp[1]=9;
temp[2]=5;
temp[3]=3;
then if i call
cout<<(atoi(temp)) it prints 0.
how can i convert temp to an integer?
hi
char * temp=new char[200];
temp[0]=1;
temp[1]=9;
temp[2]=5;
temp[3]=3;
then if i call
cout<<(atoi(temp)) it prints 0.
how can i convert temp to an integer?
still it is same althoug i did the things you say?
-mayfda-
cout << atoi(temp[x]);cout<<(atoi(temp)) it prints 0.
where x is the number in the array (1,2,3,4....200)
cout<<atoi(temp[x]);
i tried x=1
invalid conversion from `char' to `const char*'
-mayfda-
Ok I tried this :
works, but it displays the value and every value in the array after the one I wantedCode:#include <iostream.h> #include <conio.h> #include <stdlib.h> int main() { char * temp=new char[200]; temp[0]='1'; temp[1]='9'; temp[2]='5'; temp[3]='3'; cout << atoi(&temp[1]); getch(); return 0; }
int main()
{
char * temp=new char[200];
temp[0]='1';
temp[1]='9';
temp[2]='5';
temp[3]='3';
cout << atoi(&temp[1]);
getch();
return 0;
}
but i want to return whole number in here it is
1953
-mayfda-
i found the problem it is becouse of wrong pharantese organization
-mayfda-