Cant figure out whats wrong with this function but i think its probably a data type error.
Please help!

void displayName(){
    char name[30];
    int number, x;

    printf("So..what is your name?\n");
    scanf_s("%s",&name);
    printf("Nice to meet you %s, how many times would you like to be cloned?\n",name);
    scanf_s("%i", &number);
    for(x=0; x<number; x++){
        printf("%s",name);
    }
 }

What does the documentation tell you the parameteres for scanf_s should be?

Seeing as you haven't posted the actual error message, I'm guessing you're getting an error or a warning about the call to scanf_s at line 6.

Basically you don't need the & operator before name.
scanf_s expects a char * to be passed in as the 2nd parameter. And in C, arrays are implicitly pointers. So passing name will suffice, no need for the & operator. Using the & operator there converts the pointer to an incompatible type! char (*)[30]

EDIT: Not too sure I've explained the above paragraph particularly accurately...Sorry, had a few brewskies this evening! :)

What is the error ?
Why don't you use scanf() ?
And you don't need to put &name, because name is already a pointer to the address of the first character of the array

void displayName(){
    char name[30];
    int number, x;

    printf("So..what is your name?\n");
    scanf("%s",name);
    printf("Nice to meet you %s, how many times would you like to be cloned?\n",name);
    scanf("%i", &number);
    for(x=0; x<number; x++){
        printf("%s",name);
    }
 }
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.