primary expression error

Hello guys, I need help.
in this code

it shows me this error message: expected primary-expression before 'int'

I have been searching for solution for days, but couldn't find it.
I am a newbie into Arduino programming, so if you notice any mistakes please tell me.

Here is the full code:

#include <SPI.h>
#include <MFRC522.h>

#define SS_PIN 10
#define RST_PIN 9
#define LED_BUILTIN 4
MFRC522 mfrc522(SS_PIN, RST_PIN);  

void setup() 
{
 pinMode(LED_BUILTIN, OUTPUT);
 Serial.begin(9600);   
 
 SPI.begin();      
 mfrc522.PCD_Init();   
 Serial.println("Show your card to the reader...");
 Serial.println();

}
void loop() 
{

int s1,s2,ssum1,ssum2 ;



 if ( ! mfrc522.PICC_IsNewCardPresent()) 
 {
   return;
 }
 if ( ! mfrc522.PICC_ReadCardSerial()) 
 {
   return;
 }
 //Show UID on serial monitor
 Serial.print("UID tag :");
 String content= "";
 byte letter;
 for (byte i = 0; i < mfrc522.uid.size; i++) 
 {
    Serial.print(mfrc522.uid.uidByte[i] < 0x10 ? " 0" : " ");
    Serial.print(mfrc522.uid.uidByte[i], HEX);
    content.concat(String(mfrc522.uid.uidByte[i] < 0x10 ? " 0" : " "));
    content.concat(String(mfrc522.uid.uidByte[i], HEX));
 }
 Serial.println();
 Serial.print("Message : ");
 content.toUpperCase();
 if (content.substring(1) == "44 AF 79 14") //change here the UID of the card
 {
   
   s1 = 0;
   ssum1=s1+1;
   digitalWrite(LED_BUILTIN, HIGH);
   Serial.println("borrow 1 item");
   Serial.println("by Surassavate");
   Serial.println("");
   Serial.println("ssum1", int &  );
   digitalWrite(LED_BUILTIN, LOW);
   delay(1000);
   
   
 }

else if (content.substring(1) == "FB E5 31 22") //change here the UID of the card
 {
  
   digitalWrite(LED_BUILTIN, HIGH);
   Serial.println("borrow 1 item");
   Serial.println("by Nucha");
   Serial.println("");
  
   digitalWrite(LED_BUILTIN, LOW);
   delay(1000);
 
 }
else   {
   Serial.println(" Access denied");
    Serial.println();
   delay(1000);
 

 }
}

program_1.ino (1.68 KB)

Can’t read attachment on my smartphone, post the code using code tags

Now, I've change something that you can read my code. and if you can't,tell me I'll help you.

  • Press CTRL-T in the IDE to indent the code and paste it again in your first post
  • give us the exact compiler error (the whole thing with line number etc)

Why do you redefine LED_BUILTIN ? (And what arduino do you have to have this on pin 4 ?)

I'd like to help, man, so I copied this code into a new sketch and formatted it.
Braces look ok.

Won't compile, because I dont have MFRC522. So I got MFRC522 from github.

Finally, I got the info that you should have given in your request for help - the actual line causing the problem.

    Serial.println("ssum1", int &  );

Yup. That is gibberish. What were you trying to do here? It's not valid C, but it's not obvious what you were trying to do, so I can't guess what should be there instead.

Queenkajee:
it shows me this error message: expected primary-expression before 'int'

Look in the text box below your sketch and you will see the full error message, which includes the LINE NUMBER where the problem was detected. This can be a great help in figuring out what line is wrong. You can copy and paste the text in that text box just like the text in your sketch. Next time you encounter a compile problem it will help us to help you if you copy the contents of that text box (all of the messages) and paste them into your post as if they were a sketch (using code tags).

So your problem is that you miss-used the println function. It does not accept parameters the way you tried. If you want to print the value of variable ssum1 just do aSerial.println(ssum1);

The print function is documented here if you want to understand more about it.

(awe would also recommend you drop the usage of the String class and just use cStrings (the null terminated char array))