if(Student[i].regNo.campus == "KUALA LUMPUR")
			Student[i].regNo.campus = 'W';
		else if(Student[i].regNo.campus == "PERAK")
			Student[i].regNo.campus = 'a';
		else if(Student[i].regNo.campus == "PENANG")
			Student[i].regNo.campus = 'b';
		else if(Student[i].regNo.campus == "JOHOR")
			Student[i].regNo.campus = 'c';
		else if(Student[i].regNo.campus == "PAHANG")
			Student[i].regNo.campus = 'd';
		else if(Student[i].regNo.campus == "SABAH")
			Student[i].regNo.campus = 'e';

i got alot of warning message to this kind of statement..

"C:\Users\Jack\College\College\Year 1 - Semester 2\Computer Programming II\Assignment\Assignment.c(284) : warning C4047: '==' : 'int ' differs in levels of indirection from 'char [16]' "

what is this meaning ? and how can i solve it?

Recommended Answers

All 5 Replies

Number one, what is campus? Is it a c-string pointer or a character..Your comparing it it to a c-string pointer and them assigning a character to it.

So what is campus?

Adding to above post,

Student[i].regNo.campus == "KUALA LUMPUR"

This wont work. Use the function strcmp, if campus is a string

oh i got it right already..
thanks for helping to solving..
but i still one more question about strcpy.
example: strcpy(s1,"a");
i assign a into s1 right?
but why must using this (") and cannot use (') ?

Because 'a' is a character with the value 97(in the ascii codes its 97)..."a" is a c-string that has the characters 'a' and '\0'. The last character('\0') is added by the compiler.

owh..
i got it..
thanks

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.