i want to read a string containing integers and store all integers in some integer variables. e.g
str[]="12,23,45" can anyone please help me out. i tried for a space separated integers..
#include<string.h> #include<stdio.h> int main() { char buffer[]="12,34,56"; int x,y,z; if(sscanf(buffer,"%d%d%d",&x,&y,&z)>2); { printf("%d\n",x); printf("%d\n",y); printf("%d\n",z); } return 0; } Thanks for your precious time. stay happy.