hai..
how to find numbers in a char array like
Ex: [a,1,b,2,c,3] = [a,b,c,1,2,3]
Ex2: [a1,b2,c3] = [a,b,c,1,2,3]
thanks..
Printable View
hai..
how to find numbers in a char array like
Ex: [a,1,b,2,c,3] = [a,b,c,1,2,3]
Ex2: [a1,b2,c3] = [a,b,c,1,2,3]
thanks..
Post something in an actual char array.
Have different answers.Code:char x[] = "abc123";
char y[] = " [a,b,c,1,2,3]";
You need to show us exactly how your notation maps to actual stored characters in a program.
a char array contain ['a','1','b','2','c','3','d'] means output should be sort the alphabets and numbers like => abcd123
so I have to find the integer in char array how could I separate that.
Sort the array. All the digits will be in a group (either before or after the letters, depending on character set supported by your compiler and host system). Shift that group to the end of the array if it is not already there.
But how I can identify number and character in c?
If you want to identify if a char is a digit, #include <ctype.h> and use isdigit, or check that the char is between '0' and '9' inclusive.