How can i get my expected output at this code? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

How can i get my expected output at this code?

https://sololearn.com/compiler-playground/chJ1UqjkdfR8/?ref=app [Expected output] (stdout)[SHLVL=0 HBTN=Holberton ](Length: 23) (stderr)[](Length: 0) (status)[0] What should i do to get this expected output

30th Dec 2023, 4:14 PM
Abdullah Özden
3 Answers
+ 3
Abdullah Özden the Sololearn environment does not have a way to import custom .h files. You will have to copy the contents of the header file, main.h, into your code. Also, getline() seems to be unsupported here. Your code works if you make the above change and replace getline(&buffer, &bufsize, stdin) with fgets(buffer, bufsize, stdin).
30th Dec 2023, 7:19 PM
Brian
Brian - avatar
+ 2
is this what you're trying to do? #include "stdio.h" int main(int argc, char **argv, char **envp){ for(char **env=envp; *env != 0; env++){ char *thisEnv = *env; printf("%s\n", thisEnv); } }
31st Dec 2023, 1:17 AM
Bob_Li
Bob_Li - avatar
0
Brian and Bob_Li thank you for comments. Its not my codelines. This was my friend’s homework. I don’t know the c lang. I just tried to help her by asking here. Still thanks for your help.
1st Jan 2024, 2:14 AM
Abdullah Özden