Hello Cprogramming Community, I need some clarification about this particular code below:

Code:
#include <stdio.h> 
#include <stdlib.h> 
#include <string.h> 


int main(void)
{
    char phrase[80],*p;
    int i,s=0;
    gets(phrase);
    p=phrase;

    while (*p!='\0')
        if (*(p++)==' ') s++;
    printf("Phrase has %d spaces.\n",s);
    
    return 0;
}
My question is, why p++ will get incremented after the if statement?
Shouldn't it be the opposite?
I really would like some explanation on that behavior here!

Thanks in advance for your time!