jeudi 3 septembre 2015

What does " = " instead of " == " mean in c if statement?

#include <stdio.h>
int main(){
   int b = 10,a;
      if (a = 5){
         printf("%d",b);
      }
   }

In the above program if statement always returns true even if i change the data type of the variable "a" from "int" to "char".

What does = mean in the if statement??

Aucun commentaire:

Enregistrer un commentaire