Hi
I'm learning to script in C and i've noticed it's not as simple as i want it to be...
I am following the Emulov website to start learning c and in chapter 3 he tells me to make a program that has to have an input of your first and last name. each separately given in a separate string. Then he asks me to put the strings behind each other in the output and when it has done that it also has to put the strings in reverse behind each other.
I've tried to make it work.. but when the inputnames are too long it cut's them off. and with the last name the program has no problem but with the first name it gives a bunch of crap in front of the name..
it's really annoying me and when i look up the sollution on google.. the answers are all too advanced for me to understand..:/
i'm just learning about arrays and multidimensional arrays.. don't know how to work with pointers or little parts of programming defined in the same program..
my program is as follows(also an attachment to be sure):
Code:#include<stdio.h> #include<string.h> int main(void){ char content, inhoud2; char naam[0], voor[0]; int length=strlen(naam)-1, lengte=strlen(voor)-1; printf("Geef uw voornaam in: "); scanf("%s",voor); printf("Geef uw naam in: "); scanf("%s",naam); printf("U bent dus %s %s\n\n", voor, naam); printf("In omgekeerde volgorde is dat:"); for(inhoud2=length;inhoud2>-1;inhoud2--){ printf("%c", naam[inhoud2]);} printf("\n"); for(content=lengte+1;content>-1;content--){ printf("%c", voor[content]);} getch(); }
i'm sorry about the dutch words but it shouldn't matter to the advanced scripters among us...
already thx and hoping to hear something soon...