'CS50 Caesar : SEGMENTATION FAULT issue

I'm currently taking the cs50 course and I'm having an issue with the problem set 2 (caesar).I tried running the code below but it gave me a **SEGMENTATION FAULT ** warning but I can't seem to spot the problem by myself. Please what is the problem and how do I resolve it?

#include <cs50.h>
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include <stdlib.h>

bool only_digits(string s);
int main(int argc, string argv[])
{
    int i,n;
    string text;
    n = strlen(text);
    string s = argv[1];
    int k = atoi(argv[1]);

    if (argc != 2 || !only_digits(s))
    {
        printf("Usage: ./caesar key\n");
        return 1;
    }

    text = get_string("plaintext: ");

         for(i=0; i<n; i++)
    {
        if(isupper(text[i]))
        {
            char r, z;
             r = text[i] + k;
             while (r>90)
             {
                  z = r-90;
                  text[i]= 64 + z;

             }
        }

        if(!isalpha(text[i]))
        {
            text[i]= text[i]+0;
        }
    }


}


bool only_digits(string s)
{
    int i;
    int n = strlen(s);
    for (i=0; i<n; i++)
    {
        if(!isdigit(s[i]))
        {
            return false;
        }
    }
    return true;
}


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source