6th Apr 2019, 3:52 PM
徐振羽
5 Antworten
+ 9
Do you use a Chinese keyboard? In the line printf("%x",&c); you're using what looks like a Chinese comma. Replace it with an ASCII comma. Also, main() should have int as return type Gordon I think he's trying to print the address of the variable. So both %x and &c are correct (could also use %p)
6th Apr 2019, 3:56 PM
Anna
Anna - avatar
+ 7
1. int main not void main 2. , not , 3. %d not %x 4. c not &c
6th Apr 2019, 3:55 PM
Gordon
Gordon - avatar
+ 3
printf("%d",c);
6th Apr 2019, 4:03 PM
Gordon
Gordon - avatar
+ 3
printf("%d",c); prints the value of the integer variable printf("%x", &c); prints the hexadecimal representation of the variable's address
6th Apr 2019, 4:07 PM
Anna
Anna - avatar
+ 1
thanks for all the suggestions above
6th Apr 2019, 4:16 PM
徐振羽