I cant do change string to int.



char poli[50];
int p;
scanf("%s", poli);
if(poli[i]=='X' && poli[i+1]=='^')
{
toplam=i+3;
p=poli[i+2];

p is a ASCII code of integer but I need integer
for example if poli[i+2]='2' it puts p 50 (ascii code of '2')
but I need p=2 integer form, how can I do, please help

.



Relevant Pages

  • Re: I cant do change string to int.
    ... esirik(hacettepe computer science and engineering) ... scanf("%s", poli); ... p is a ASCII code of integer but I need integer ...
    (comp.lang.c)
  • Re: I cant do change string to int.
    ... int i,d,l,toplam,polinom; ... scanfexceed the bounds of 'poli' and overwrite memory it ... Note that 'sizeof poli' only works as expected within the function ... Because 'z' is always zero. ...
    (comp.lang.c)
  • Re: I cant do change string to int.
    ... int i,d,l,toplam,polinom; ... scanfexceed the bounds of 'poli' and overwrite memory it ... Note that 'sizeof poli' only works as expected within the function ... Note also that scanf and fgets return values which should be checked, otherwise you won't know if you actually received *any* input. ...
    (comp.lang.c)
  • Re: char conversion problem
    ... > If you want to strip numbers from the ASCII code, ... > the decimal numeric equivalent to the ascii number. ... > int num_seeker{ ...
    (comp.lang.cpp)