I've been trying to fix this source code for a long time but the compiler still shows error.
#include<cs50.h>    
#include<stdio.h>   
#include<string.h>
#include<stdlib.h>
#include<ctype.h>
int main(int argc, char* argv[])
{
    char ptext[40];
    int i=0;
    if(argc!=2)
    {
        printf("invalid key");
        return 1;
    }
    else
        printf("enter plain text\n");
    ptext= GetString();
    int key= atoi(argv[1]);
    int n=strlen(ptext);
    while( ptext[i]!= '\0')
    {
        if( ptext[i]>65 && ptext[i]<90)
        {
            int c= (ptext+key)%26;
            int d= c+26;
            printf("%c", d);
        }
        else if( ptext[i]>97 && ptext[i]<122)
        {
            int c= (ptext+key)%26;
            int d= c+26;
            printf("%c", d);
        }
        else
        {
            printf("%c",ptext[i]);
        }
        i++;
    }
}
The errors it shows while compiling are array type 'char [40]' is not assignable (which does nothing even when a number smaller than 40 is entered or the brackets are left empty), and invalid operands to binary operation int c = (ptext+key)%26.
 
     
     
    