I have to take input like this in two different variables.
e.g.
I am an engineering student, 34.
string:- I am an engineering student.
int:- 34
I have to take input like this in two different variables.
e.g.
I am an engineering student, 34.
string:- I am an engineering student.
int:- 34
#include <stdio.h>
int main()
{
char str[100];
int age;
scanf("%[^,],%d",str,&age);
printf("str=%s\nage=%d",str,age);
return 0;
}
scanf
can set what character to terminate