470,831 Members | 1,412 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,831 developers. It's quick & easy.

Help Me! 6:12: error: comparison between pointer and integer ('char' and 'const char *')

5 Nibble
Well, dudes, I'm back for another question:What deal is with this?
The error is:
tempCodeRunnerFile.cpp:6:12: error: comparison between pointer and integer ('char' and 'const char *')
So next, there is my code:
#include <iostream>
using namespace std;
int main() {
char a;
int ascii,suma,sumb,sumc;
if (ascii>60&&ascii<123||ascii>64&&ascii<91){
if (ascii>47&&ascii<58) {
if (ascii>31&&ascii<48) {
if (ascii==63) {
return 0;
(Tips:I'm using Visual Studio Code.)
6 Days Ago #1
1 3323
575 Expert 512MB
Expand|Select|Wrap|Line Numbers
  1. while ( a != "?" ){
Double quotes are used for string literal. In the first iteration, a isn't initialized to a value and used for comparison in an entry-controlled loop.

Expand|Select|Wrap|Line Numbers
  1. a = ascii;
Why would you update a after the input?

ascii is never initialized.

Increment to suma, sumb and sumc are done without any initial value.
4 Days Ago #2

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

6 posts views Thread by wukexin | last post: by
3 posts views Thread by Colin J. Williams | last post: by
7 posts views Thread by Corepaul | last post: by
5 posts views Thread by Steve | last post: by
9 posts views Thread by JJ | last post: by
8 posts views Thread by Mark | last post: by
3 posts views Thread by lord.zoltar | last post: by
reply views Thread by mihailmihai484 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.