I've a function returning a pointer to a string in C and I'm trying to access the entirety of the string but I'm not sure how to. 

I've a function that loops threw a linked list of structs containing student data and gets the student's names. I want to pad spaces onto the ends of each string so they are all the same size. So I wrote a function for padding the strings. The function returns a pointer to the string but I don't know how to access the whole string from the pointer. I know I can put \*pstring to get the first character of the string but I'm a little lost on how to get the rest. 

This loops through the linked list:

```
void myFunction(void) {

    pStudent = pHead;
    char paddedName[30];
    long nameLength = 0 ;

    while(pStudent->pNext != NULL){
        printf("%c,\n", *padstring(pStudent->name));
        strcpy(paddedName, padstring(pStudent->name));
        nameLength = strlen(paddedName);
        printf("%lu | %s | %s \n", nameLength, paddedName, pStudent->name);
        pStudent = pStudent->pNext;
    }
    printf("\n");

}

```

This pads and returns the string:

```
char *padstring(char* string){

    char name[30];
    int i = 0;

    while(i < 30){
        if(i < strlen(string)){
            name[i] = string[i];
                    }
        else{
            name[i] = ' ';
        }
        i++;
    }
    printf("%s,\n", name);
    return name;

}

```