I need to make a program that takes out the first letter of a word through a function in C, without using characteristics of Arrays.
I have this code:
#include <stdio.h>
#include <string.h>
char dimeLetra(char[]);
int main(){
char palabra[20];
char letra;
printf("Introduce tu palabra: ");
scanf("%s",&palabra);
letra = dimeLetra(&palabra);
printf("%c",letra);
}
char dimeLetra(char p[]){
printf("%s",p);
char l;
strncpy(l,p,0);
return l;
}
I can not get the dimeLetra
function to return the first letter of the word I send to it.
Any ideas?