>>Problem with strings in C

Status
Not open for further replies.

Joyhtidas

Member level 4
Joined
Nov 30, 2009
Messages
72
Helped
4
Reputation
8
Reaction score
1
Trophy points
1,288
Location
Bangalore, India
Activity points
1,709
hi...
i am using one array ...Array[12]... here i am passing values one by one..
say.... 'A','9','0',' ','X','3','6','0'.... (see one space is there in between ) ... And at one condition i need to check
that the string 'A90' is there or not and string 'X360' is there or not using an
SWITCH condition.... here i got troubled here ....
friends pls tell some logic....
 

If you put your case like

case "A90":

then that is not going to work. Switch statement works on integers only.
 

Adding to GSMman's comment:
And don't forget if-else statements
 

Thank you very much...
I got the problem solved...
I don't know about the function strstr()
......Thanks a lot..
 

Joyhtidas said:
I don't know about the function strstr()
If you are going to program in 'C' you should familiarize yourself with the "ANSI C standard library". This is a set of functions supplied with most C compilers. It includes funcitons for I/O, math, string manipulation, type conversion, etc. Using these functions can save you a lot of development effort and improve the portablity of your code.

You can serch the web for references - this Wikipedia entry is a good introduction: https://en.wikipedia.org/wiki/C_standard_library
 

You can simply do it by using a for loop and if-else statements.
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…