My function gets a four array as input if it contains the character e
So it changes with a
and returns the new four array. This is my code:
Four eminent (four words []) {int total = 0; Int i; Four finals [5]; For (i = 0; i <5; i ++) {if (word [i] == 'e') {last [i] == 'a'; } And {final [i] == word [i]; }} Return final; }
I call it the main ()
function like this:
int main () {char a [] = "Hayley"; Printf ("The new string is:% d \ n", the azer (a)); }
This gives me this output:
is the new string: -48
What do I remember Is here?
There are many errors in your program, assuming the length of the string. NULL
is not allowing the terminator to write, or the write indicator is not returning ==
where you mean =
A local variable is trying to return.
#include & lt; Stdio.h & gt; # Include & lt; Stdlib.h & gt; #include & lt; String.h & gt; Four * echanger (four * words) {int len = strlen (word); Int i; Four * final = maulok (lane + 1); For (i = 0; i & lt; = len; i ++) {// Terminator included if (word [i] == 'e') last [i] = 'a'; And the last [i] = word [i]; } Return final; } Int main () {char a [] = "helle"; Four * news; News = azanger (a); Printf ("new string:% s \ n", news); Free (news); // Molok Returns was 0; }
Program output:
is the new string: halla
No comments:
Post a Comment