the first function works (int length (char a[]), but the output to the second function is -28865. I need to use pointers and pointer arithmatic.
Code:
#include <stdio.h>
#include <string.h>
int length (char a[]);
int point_size (int *a);
int main()
{
char word[]="Trying this out";
int size;
int pointer_eh;
size = length (word);
printf("The length is %d\n", size);
printf("The length is %d", pointer_eh);
return 0;
}
int length (char a[])
{
int i;
int size=0;
clrscr();
for (i = 0; i != strlen(a); i++)
{
size++;
}
return(size);
}
int point_size (int *a)
{
int i, pointer_eh;
while (*a[i] != '\0')
{
*(a+1);
i++;
}
return (pointer_eh);
}