Hey! I am super new to C programming- just started it. I have a task:
"Write a program which calculates length of a string entered by user, up to 10symbols, calculation and user input should be done in separate functions"
I am having problems with input() function. Yes, I know that it should not return(str), but I really cant understand this this- what/how I'm supposed to return from input() so that len() can do his stuff...Code:#include <stdio.h> #define E 10 int input(); int len (char *str); int main () { char str[E]; printf("Write something!\n"); input(); len(str); return 0; } int input(){ char str[E]; scanf("%s", str); return (str); } int len (char *str){ int i; for(i = 0; str[i] != '\0'; ++i); printf("Length of string is |%d|", i); return 0; }