Answer the question
In order to leave comments, you need to log in
Why does the code fail?
#include <stdio.h>
#include <stdlib.h>
#include <locale.h>
#include <ctype.h>
int main()
{
setlocale(LC_ALL,"Rus");
char a;
scanf("%s",a);
printf("%s",a);
int num;
num = atoi(a);
printf("%d",num);
return 0;
}
Answer the question
In order to leave comments, you need to log in
the scanf function works with pointers, so you had to pass not "a" as a parameter, but an address pointing to "a", in other words, write: scanf("%s", &a)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question